Java Script Task 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 one Two option set named as DMPS Type in case entity if the DMPS Type is yes then only show the DMPS if you choose DMPS Type as No then show other than DMPS.
1) Create one Two Option set field named as DMPS Type in case entity
2) In Case Entity already we have Origin Option set, In this option need to add one more value named as DMPS
3) Write a java script code and Add this code into Web Resource
· Add On-change event to DMPS type field (Two option set)
Create one Two option set (DMPS type) field in case entity
Add one value (DMPS) in Origin field option set
Code:
function caseDMPS(executionContext)
{
var formContext = executionContext.getFormContext();
var DMPStype = formContext.getAttribute("new_dmpstype").getValue();
var origin = formContext.getAttribute("caseorigincode").getOptions();
var dmps = { value: 0, text:"DMPS" };
var phone = { value: 1, text:"Phone" };
var email = { value: 2, text:"Email" };
var web = { value: 3, text:"Web" };
var fb = { value: 2483, text:"Facebook" };
var tw = { value: 3986, text:"Twitter" };
var IOT = { value: 700610000, text:"IoT" };
for (var i = 0; i < origin.length; i++)
{
formContext.getControl("caseorigincode").removeOption(origin[i].value);
}
if (DMPStype == true)
{
formContext.getControl("caseorigincode").addOption(dmps);
}
else
{
formContext.getControl("caseorigincode").addOption(phone);
formContext.getControl("caseorigincode").addOption(email);
formContext.getControl("caseorigincode").addOption(web);
formContext.getControl("caseorigincode").addOption(fb);
formContext.getControl("caseorigincode").addOption(tw);
formContext.getControl("caseorigincode").addOption(IOT);
}
}
Create one web Resource and add this code into this web Resource
Click on case entity form properties and add web Resource here
Output:
Comments
Post a Comment