DEPENDENCY OPTIONSET

This is the concept based on dependency. It means one option set is dependent on another option set.

For EX:I have a requirement to display all the related values of first option set in second option set only when I select a particular label in first option set.

CONTENTS REQUIRED:

1) Jscript library

2) Form Event

3) XML Webresouce

Then we have to do the following steps

STEP 1:

Open your CRM. Create two option set fields in an entity and add the options in both fields.

Ex: My requirement is I have two option set fields named vehicle types and vehicles. When I choose an option in an vehicle type as parent option set, then I have to get the dependent fields of that particular option only in dependent option set.

clip_image002

Fig: entity creation

clip_image004

Fig: creating parent option set field

clip_image006

Fig: creating dependent option set field

clip_image008

Fig: vehicles field creation and publish ion

clip_image009

Add those fields to the vehicle entity form.

 
 clip_image010

clip_image011Then save

Publish

clip_image013

Fig: inserting fields to form and get published

Step 2:

Create a web resource named vehiclexml which is of xml type in our CRM solution.

Open the Visual studio and select an xml file in it and the develop the xml code for that following option sets.

clip_image015

Fig: vehiclexml.xml file

clip_image017

Fig: Creating web resource xml file

clip_image019

clip_image021

 

STEP 3:

Creating another web resource of java script file named DependentOptionSetSample.js

following code in that and save it.

clip_image023

· above Java Script file find in below link

https://msdn.microsoft.com/en-us/library/gg594433(v=crm.7).aspx

clip_image025

clip_image027

Fig: Creating web resource of Jscript

clip_image028STEP 4:

Goto main form in vehicle entity

clip_image029

Form properties.

In that add the library file of Jscript that was generated in web resources.

clip_image031

Fig: Adding Jscript file to the library

clip_image032clip_image034

clip_image036

clip_image038

Now goto the field of parent option type and then double click on it.

It opens the event handler where we have to add the functionality of dependency.

clip_image040

clip_image042

clip_image044

Then go to your CRM and the test the fields on the entity that you have created.

The following output screen shots are provided here

Output Screen shots:

1) The field vehicles is locked because it is dependent on parent option set field named vehicletype.

clip_image046

 

2) Select any option in parent option field.

clip_image048

3)The related options will appear in the dependent option field

clip_image050

About Apps Now

Apps Now offers latest reads on Microsoft Technologies and Business Applications in an easily understandable and digestible manner for you to drive some mileage out of it. Keep following Apps Now to learn new technologies and best coding practices.

See more blogs from Apps Now

No Comments

Add a Comment

  1. (max length 2000)
  2. captcha refresh captcha
Please Wait