الأحد، 8 سبتمبر 2013

CRM 2011: Access Is Denied (you don't have enough privileges to access Microsoft Dynamics CRM object or perform request....)

SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: xxxxxxxxxxxx, OwnerId: xxxxxx,  OwnerIdType: 8 and CallingUser: xxxxxxx. ObjectTypeCode: 8, objectBusinessUnitId: xxxxxxxxxx, AccessRights: AppendToAccess Detail:
1- write the following command to SQL server
  Select Name,LogicalName From MetadataSchema.Entity Where ObjectTypeCode=8

2- Go to CRM Security role and select the user role and from the Business Management Tab give the "append" and "append to" for entity user to oirganization.

الثلاثاء، 27 أغسطس 2013

CRM 2011: Handling Tab click event

///************* Handing All From Tabs click event *****************

function TabsClickeHandler(MyFunctionName) {
            var TabLinksContainer = document.getElementById("ulTabLinks");
            var Li_items = TabLinksContainer.getElementsByTagName("li");
            for (var i = 0; i < Li_items.length; ++i) {
                //Get 'a' Tages Name.
                var Links = Li_items[i].getElementsByTagName("a");

                if (Links[0].addEventListener) {   // all browsers except IE before version 9
                    //Attach ‘onclick’ event handler to "Tab"
                    Links[0].addEventListener("click", function () { MyFunctionName(); }, false);
                }
                else if (Link[0].attachEvent) {    // IE before version 9
                    //Attach ‘onclick’ event handler to "Tab"
                    Links[0].attachEvent('onclick', function () { MyFunctionName(); });
                }
            }
        }
///**************** Handing  Only One Tab click event ********

function OneTabClickeHandler(TabId,MyFunctionName) {
            //the ID of ‘tab’
            var Tab = document.getElementById(TabId);

                if (Tab.addEventListener) {   // all browsers except IE before version 9
                    //Attach ‘onclick’ event handler to "Tab"
                    Tab.addEventListener("click", function () { MyFunctionName(); }, false);
                }
                else if (Tab.attachEvent) {    // IE before version 9
                    //Attach ‘onclick’ event handler to "Tab"
                    Tab.attachEvent('onclick', function () { MyFunctionName(); });
                }
        }

الثلاثاء، 20 أغسطس 2013

SSRS: Cannot create a connection to data source ‘CRM.’ (rsErrorOpeningConnection) Guid should contain 32 digits with 4 dashes


To run the report from the report server Url, you might find that if you are using normal domain account for username/password you will get the following error:


An error has occurred during report processing (rsProcessingAborted) Cannot create a connection to data source ‘CRM.’ (rsErrorOpeningConnection) Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

This is because the Username should be 'systemuserid' and the Password should be 'organizationid'. You can get this by running the query against the CRM database:


SELECT fullname, systemuserid, organizationid FROM FilteredSystemUser Order By fullname

الأحد، 18 أغسطس 2013

How to Select from stored procedure in SQL?

We can't execute a Stored Procedure in a Select statement.You can use a User-defined function or a view instead of a procedure

 but you can copy output from Stored Procedure to temporary table as blow:

CREATE TABLE #Result
(
  Column_Name1 Nvarchar(50),  
  Column_Name2 Int
)
INSERT #Result exec Stored_Procedure_Name @Parameter1,@Parameter2
SELECT Sum(Column_Name2) as Total  FROM #Result
where "Condition Here"
DROP TABLE #Result