CRM 2011 Context Depth Issue


Danny Varghese's avatarDanny Varghese's Blog

With CRM 2011 events now being transactional, i.e. when an error occurs, the requested change is rolled back, this has posed its own unique set of problems.  Here’s one I faced recently…

Background Information:

Let’s say a user enters information on a form on any entity and clicks save.  Like any other .NET web application, the data entered by the user is then submitted to the database.  Validation occurs, and if valid, the data is submitted and then finally committed to the database.  The resulting values (including any calculations done by CRM plug-ins) are returned back to the form for the user to see.

In CRM 4.0, all the values entered on a form are submitted to the database as a collection of properties (field names and values).  If any validation errors occurs, the collection of properties containing the values the user entered is NOT submitted, but rather the collection…

View original post 382 more words

Fixed – Unhandled Exception: Microsoft.Crm.CrmException: Cannot create a lookup without the required parameters in CRM 2013


Hi,

Got this error in one of the steps in the Action. It was updating one of the lookup field using Update step.

The issue was that the lookup field was not in the form. Adding that particular field in the form back resolved the issue.

Hope this helps..

 

 

JavaScript Reference for Microsoft Dynamics CRM 2011 / 2013


Nice compilation ..

http://www.stunnware.com/crm2/topic.aspx?id=js13

Check if a user is a SharePoint Administrator in JavaScript – SharePoint 2013.


Hi,

Had a requirement to check if user is a SharePoint Admin or not and accordingly hide few elements in the page. We used the below code in our custom master page

Sample Code


var currentUser;

function IsUserAdmin() {
clientContext = SP.ClientContext.get_current();
spWeb = clientContext.get_web();
currentUser = spWeb.get_currentUser();
clientContext.load(currentUser);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded(sender, args) {

var isUserAdmin = currentUser.get_isSiteAdmin();
if (isUserAdmin) {

alert('Current User is Administrator');

} else {

alert('Current User is not an Administrator');
}
}

function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}

ExecuteOrDelayUntilScriptLoaded(GetCount, "sp.js");

Hope it helps ..

How to – Showing Total in Footer in jqGrid.


Hi,

We recently had a requirement to show total for 2 of our decimal columns in jqGrid.

We need to set the following properties footerrow and userDataOnFooter and the a function on loadComplete of grid

Hope it helps..

Advertisements

Using CreateMultiEntityAssociation method of CRMServiceClient for 1: n records.


Hi,

CreateMultiEntityAssociation method of CrmServiceclient can be used for associating 1 : n records i.e. if we have one contact record that we want to associate with multiple opportunity record ( 1-n) then we can use that method. This way we wont have to update each individual record.

http://msdn.microsoft.com/en-us/library/microsoft.xrm.tooling.connector.crmserviceclient.createmultientityassociation.aspx

Sample Code


Uri organizationUri = new Uri("http://server/crmrog/XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultCredentials;
OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);

CrmServiceClient crmServiceClient = new CrmServiceClient(orgProxy);
List<Guid> lstOpportunityGuid = new List<Guid>();
lstOpportunityGuid.Add(new Guid("9DDCE989-0738-E411-9878-00155D56FF56"));
lstOpportunityGuid.Add(new Guid("019E1598-0738-E411-9878-00155D56FF56"));
lstOpportunityGuid.Add(new Guid("EA393A91-0738-E411-9878-00155D56FF56"));
crmServiceClient.CreateMultiEntityAssociation("contact", new Guid("CF1FC3C0-0738-E411-9878-00155D56FF56"), "opportunity", lstOpportunityGuid, "opportunity_customer_contacts");

Hope it helps ..