Hi,
I am running into a requirement to update an optionset field based on the value in rollup field which can go up and down, eg if Rollup = 1, Optionset = Low, if Rollup = 2, Optionset = Medium and so on..
Please suggest if my script is incorrect, will it update the opionset without opening the record and if none of the two options given belowwill work what else i can try?
The two solutions i tried but none seems to be working:
Option 1:
Use Business Rule to update a temporary field from rollup and then use that temporary field in a workflow to manage the option set values.
Problem with this approach is that temporary field doesn't get updated until we open the form as business rules seems to work on load or on save which means all our views to show the optionset value will always be incorrect until we open the record.
Option 2:
I tried to add javascript on field change (rollup field) below is my code running without error conditions working fine but for some reason it is not setting value and also i am not sure if this will update the optionset without opening the form:
function SetRisk() {
var a = Xrm.Page.getAttribute("jmfloc_vulnerabilityscore").getValue();
if(a == 1 || a== 2 || a==3)
{
Xrm.Page.getAttribute("jmfinn_amlhighrisk").setValue("Low") ;
}
if(a == 4 || a== 5 || a==6)
{
Xrm.Page.getAttribute("jmfinn_amlhighrisk").setValue(906010002) ; tried with single, double quotes also
}
if(a == 7 || a== 8 || a==9)
{
Xrm.Page.getAttribute("jmfinn_amlhighrisk").setValue(906010001) ;
}
if(a >=10)
{
Xrm.Page.getAttribute("jmfinn_amlhighrisk").setValue(906010000) ;
}
}
Thanks,
PS