7. Create a case DMPS type yes or no field, if yes then show case origin only DMPS or show other option expect DMPS.

 

User story:  Create a case DMPS type yes or no field, if yes then show case origin only DMPS or show other option expect DMPS.

Requirement: JavaScript

1.     Create one Two Option Set field with the name of DMPS Type in Case entity

2.     Add one value in Origin field with the name of DMPS

3.     Write a JavaScript code for below logic and place it in web resource

4.     If I select DMPS type as true

·        In Origin field it will show only DMPS option only

·        And hide all other options

5.     If I select DMPS type as false

·        In Origin field it will DMPS field

·        And it shows all other fields

6.     Call the JavaScript function from DMPS Type field on change

 

Create one Two Option Set field with the name of DMPS Type in Case entity




Add one value in Origin field with the name of DMPS

 


Write a JavaScript code and place it in web resource

function dmpsType(executionContext)

{

    var formContext = executionContext.getFormContext();

    var dmps = formContext.getAttribute("new_dmpstype").getValue();

   // var org = formContext.getControl("caseorigincode");

    var originSet = formContext.getAttribute("caseorigincode").getOptions();

    var dm = { value: 4, text:"DMPS" };

    var phone = { value: 1, text:"Phone" };

    var email = { value: 2, text:"Email" };

    var web = { value: 3, text:"Web" };

    var faceBook = { value: 2483, text:"Facebook" };

    var twitter = { value: 3986, text:"Twitter" };

    var Iot = { value: 700610000, text:"IoT"}; 

   

    for (var i = 0; i < originSet.length; i++) {

        formContext.getControl("caseorigincode").removeOption(originSet[i].value);

    }

 

    if (dmps == true) {

        formContext.getControl("caseorigincode").addOption(dm);

 

    }

    else {

        formContext.getControl("caseorigincode").addOption(phone);

        formContext.getControl("caseorigincode").addOption(email);

        formContext.getControl("caseorigincode").addOption(web);

        formContext.getControl("caseorigincode").addOption(faceBook);

        formContext.getControl("caseorigincode").addOption(twitter);

        formContext.getControl("caseorigincode").addOption(Iot);

    }  

}

 Call the JavaScript function from DMPS Type field on change


 

Out Put:


 


Comments

Popular posts from this blog

2. On Click of case Reject button, show popup with reject reason text, once filled and submitted, reject reason field should get filled and case should be in read only

1. In Case Entity, based on Incident Type selection, filter the case category using the category-incident master entity

8. On selection of asset in case entity, read the project in asset, project start date and end date from project entity, set the dates on case entity from as project start date and end dates