Creating records in CRM 2011 using JavaScript

Using the CRM Web Service, you can create new entity records, just using JavaScript. The following code demonstrates this: // Make Struct function MakeStruct(names) { var names = names.split(‘ ‘); var count = names.length; function constructor() { for (var i = 0; i < count; i++) { this[names[i]] = arguments[i]; } } return constructor; }… Continue reading Creating records in CRM 2011 using JavaScript

Set a lookup value in CRM 2011

// Sets the lookup value for a certain field function SetLookupValue(fieldName, id, name, entityType) { if(fieldName != null) { var lookupValue = new Array(); lookupValue[0] = new Object(); lookupValue[0].id = id; lookupValue[0].name = name; lookupValue[0].entityType = entityType; Xrm.Page.getAttribute(fieldName).setValue(lookupValue); } }

Another way of loading certain CRM Views into an IFRAME on the main form

Since every CRM View has its own GUID and can be launched using the Advanced Find out-of-the-box functionality, you can follow several easy steps to load what view you want (with whatever additional filters you want) in a certain IFRAME available on the crmForm.Here’s the scenario: you wanna display your active contacts (My Active Contacts… Continue reading Another way of loading certain CRM Views into an IFRAME on the main form

MS CRM 3.0 “Expected ‘}’” and “Object expected” errors

Hello, there 🙂 Have you ever encountered this situation? You write some decent, valid JS code, throw it inside a CRM field event box, Save & Close x2, publish, test, BAM!-error? Well, provided your code is actually correct (no logical, typing or access errors), you should check the next thing. In CRM 3.0 at least… Continue reading MS CRM 3.0 “Expected ‘}’” and “Object expected” errors