如果它没有值做一件事,否则做别的事情。请参阅下面的代码。这目前无效。我很确定我的if语句不正确但不确定如何修复
if(new_steponecontractrecieved)
{
Xrm.Page.getAttribute("new_totalamountcollected").setValue(item2);
} else
{
Xrm.Page.getAttribute("new_totalamountcollected").setValue(item1+item2);
}
答案 0 :(得分:4)
请尝试以下代码:
var new_steponecontractrecieved= Xrm.Page.getAttribute("new_steponecontractrecieved");
if(new_steponecontractrecieved!=null && new_steponecontractrecieved.getValue()!=null)
{
//have a value do one thing
}
else if(new_steponecontractrecieved!=null)
{
//does not have a value do other thing
}