Fixed – Expected identifier, string or number error in HTML Web Resource in IE.


We recently developed an html web resource which was using jqGrid. The web resource was working properly on machines having IE 10 browser, but got the above error in case of IE 8.

As it turned out extra “,” i.e. trailing comma was the reason for the error.

Removing it fixed the issue. IE 10 was more forgiving.

Hope it helps.

Sample Code: OData Synchronous Call in CRM 2011


Just sharing the sample code to make synchronous OData call in CRM 2011.


var oDataRequestUrl = http://server/orgname/xrmservices/2011/OrganizationData.svc/ContactSet?$select=FullName

var result = syncODataCall(oDataRequestUrl);

// function to make synchronous oData call
 function syncODataCall(odataSelect) {
 var request = new XMLHttpRequest();
 request.open("GET", odataSelect, false);
 request.setRequestHeader("Accept", "application/json");
 request.setRequestHeader("Content-Type", "application/json; charset=utf-8");
 request.send();
 var objJQuery = jQuery.parseJSON(request.responseText);
 return objJQuery.d
 }

Check for following methods to parse the result returned

  • ProcessReturnedEntities(data.d.results)
  • ProcessReturnedEntity(data.d)

http://crmscape.blogspot.in/2011/03/crm-2011-odata-json-and-crm-forms.html

Hope it helps !

Retrieve OptionSet Label using SDK.Metadata.RertrieveAttribute method in JavaScript (CRM 2011)


Hi,

Recently we were working on an HTML Web Resource which was using oData to fetch information regarding a particular entity which had multiple optionset fields in it.

As we know using oData we can get the value of the optionset field but not the label. While searching for the best possible way to get the label in Jscript came to know about the sdk.metadata.js sample code in SDK (sdk\samplecode\js\soapforjscript\soapforjscript\scripts)

It has RetrieveAttribute method in it which can be used to get the attribute metadata

We had an optionset attribute named Language in it, this is how we fetched all the label and the value for that field


var languageArray = [];

// this.RetrieveAttribute = function (EntityLogicalName, AttributeLogicalName, MetadataId, RetrieveAsIfPublished, successCallBack, errorCallBack, passThroughObject
 SDK.Metadata.RetrieveAttribute("new_lawyer", "new_primary_language", null, true, function (result) {

for (var i = 0; i < result.OptionSet.Options.length; i++) {
 languageArray[result.OptionSet.Options[i].Value] = result.OptionSet.Options[i].Label.LocalizedLabels[0].Label;
 }
 },
 function (error) {
 alert("error");
 }
 );

Hope it helps !

Cleared MB2-703: Microsoft Dynamics CRM 2013 Customization and Configuration Exam.


Finally took and cleared my first CRM 2013 exam i.e. Customization and Configuration today.

It had total 48 questions in it with passing score of 700.

As expected the main focus area were

  • Access Teams
  • Business Process Flows
  • Business Rules
  • Quick Create forms.
  • New Controls

So anyone planning to take this exam should focus around these new features added in CRM 2013.

Bye.

How to – Get OptionSet Label using FormattedValues property of Entity in Plugin in CRM


The easiest way to get the Label for the option set in plugin is using the FormattedValues property of the Entity.

The Post Create plugin on Contact record getting the label for the address type field.


if (context.InputParameters.Contains(“Target”) && 
context.InputParameters[“Target”] is Entity){

// Obtain the target entity from the input parmameters. 

Entity entity = (Entity) context.InputParameters[“Target”];

if(entity.Contains(“address1_addresstypecode”)){

string addressTypeCodeLabel = entity.FormattedValues[“address1_addresstypecode”];

entity.Attributes[“address1_city”] = addressTypeCodeLabel;

service.Update(entity);}

}

http://community.dynamics.com/crm/b/crmmitchmilam/archive/2013/04/18/crm-sdk-nugget-entity-formattedvalues-property.aspx

Hope it helps.

Advertisements

Mark Complete an Activity on create through Plugin in CRM 2011.


Hi,

We had a requirement to immediately close the Appointment record as completed after creating it. The initial thought was to call Set State Request on the Post Create plugin. That approach gave error. Then we tried passing statecode and statuscode value as input parameter in Pre Plugin. That approach also didn’t work.

Finally we registered a pre update plugin on appointment entity and set the values for statecode and statuscode attributes. This worked for us.

The learning is that on create of Appointment record, update message is also called.

Sample Code (Pre Update)

Hope it helps.