Microsoft Dynamics CRM 2015 | Update 1 – Lessons Learned Part IV

Lessons_Learned

Though Part I, Part II and Part III was written in german language – because of the popularity I decided to switch to english this time. Recently we´ve been part of a couple of migration projects where we supported partners/customers to migrate their existing solutions to work successfully with Microsoft Dynamics CRM 2015 Update 1.

One of the famous customizations we figured out is to create a customer attribute by manipulating an existing lookup field to allow searching for multiple entities and storing the value.

To identify this customization you should take a look at the following lines of code:

lookuptypeIcons = ‚/_imgs/ico_16_2.gif:/_imgs/ico_16_4.gif:/_imgs/ico_16_8.gif‘;
lookuptypenames = ‚contact:2:Contact,lead:4:Lead,systemuser:8:User‘;
lookuptypes = ‚2,4,8‘;

document.getElementById(„xxx“).setAttribute(„lookuptypes“, lookuptypes);
document.getElementById(„xxx“).setAttribute(„lookuptypenames“, lookuptypenames);
document.getElementById(„xxx“).setAttribute(„lookuptypeIcons“, lookuptypeIcons);
document.getElementById(„xxx“).setAttribute(„defaulttype“, „4“);
  …
  value[0].displayClass = „ms-crm-Lookup-Item“;
  value[0].keyValues = new Object();
  value[0].values = new Object();
  value[0].onclick = „openlui()“;
  value[0].id = savedId;
  value[0].entityType = savedEntityName;
  value[0].typename = savedEntityName;
  value[0].name = savedName;
  value[0].type = savedType;
  Xrm.Page.getAttribute(„xxx“).setValue(value);

Update1_Script_Error_DOM_ManipulationThe issue you’ll find using this type of customization is, that it contains unsupported code and DOM Manipulation. Therefore you will receive an error message like this during onLoad(). As the Custom Code Validation (CCV) Tool probably won´t recognize this as unsupported, cause it cannot identify what the code action does, you´ll have to identify manually, if you´re using this kind of customization.

Now that you´ve identified such customization – what are your options to correct the code and stay supported? As we currently don´t have an attribute type “customer” we can add to our form, the supported options would be:

a) avoid using a customer attribute and try to use an assigning to account, lead or contact directly

b) build a web-resource (HTML) and build a custom attribute to request data from different entity types and store the information inside the appropriate attirbute, such as a hidden account, contact or lead lookup

c) go for a custom activity entity where you´ll get a regarding attribute by default which is a multiple entity lookup control.

You do have other options and want others to participate from? Just send a comment and help others staying supported and avoid getting unwanted script error messages while upgrading to Microsoft Dynamics CRM 2015 Update 1.

Until next time…

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s