开发者

Disabling picklist field function resets value Dynamics crm 4.0 Javascript

My situation is that I have a field new_outcome that is a picklist with default value of null. Up on changing this field and selecting a value the field and its associated fields then needs to be locked and disabled. Up on reopening the record this script is to run again and the field remain disabled. This is working fine in that when selecting the value the function is called and the field becomes disabled. The issue is upon reopening the record, the function is called but the if clauses don't meet the criteria because the new_outcome picklist field is back to a null value so is therefore no longer disabled. I'm guessing this is to do with needing to force submit the new开发者_如何学Python_outcome value but I can't seem to get it to work.

Sample without the forcesubmit:

  Stage2Lock = function()
{
if ((crmForm.all.new_outcome.DataValue != null) && (crmForm.all.casetypecode.DataValue == 1))
{
crmForm.all.new_extensionreason.Disabled =true;
crmForm.all.new_outcome.Disabled =true;
}
else
{
crmForm.all.new_extensionreason.Disabled =false;
crmForm.all.new_outcome.Disabled =false;
}
}

Any suggestions?


What about calling crmForm.Save() so the value persists?


I think your suspicion is right. One thing I have noticed in a number of forums is people not putting the action in Upper case, but it looks like you are doing that with Disabled (so I assume you are also doing that with ForceSubmit ). Try updating the function to read as follows:

Stage2Lock = function()
{
if ((crmForm.all.new_outcome.DataValue != null) && (crmForm.all.casetypecode.DataValue == 1))
{
crmForm.all.new_extensionreason.Disabled =true;
crmForm.all.new_outcome.Disabled =true;
crmForm.all.new_extensionreason.ForceSubmit =true;
crmForm.all.new_outcome.ForceSubmit =true;
}
else
{
crmForm.all.new_extensionreason.Disabled =false;
crmForm.all.new_outcome.Disabled =false;
}
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜