禁用选项列表字段功能重置值 Dynamics crm 4.0 Javascript
我的情况是,我有一个字段 new_outcome
,它是默认值为 null
的选项列表。更改此字段并选择一个值后,需要锁定并禁用该字段及其关联字段。重新打开记录后,此脚本将再次运行,并且该字段保持禁用状态。这工作得很好,因为当选择值时,函数被调用并且该字段被禁用。问题是在重新打开记录时,调用该函数,但 if 子句不满足条件,因为 new_outcome
选择列表字段返回到空值,因此不再禁用。我猜这与需要强制提交 new_outcome 值有关,但我似乎无法让它工作。
没有 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;
}
}
有什么建议吗?
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_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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调用 crmForm.Save() 使值保持不变怎么样?
What about calling crmForm.Save() so the value persists?
我认为你的怀疑是对的。我在许多论坛中注意到的一件事是,人们没有将操作设置为大写,但看起来您正在使用“禁用”来执行此操作(所以我假设您也在使用“ForceSubmit”执行此操作)。尝试将函数更新为如下所示:
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: