admin管理员组

文章数量:1392054

If it does not have a value do one thing, else do something else. See my code below. This is currently not working. I'm pretty sure my if statement is incorrect but unsure how to fix

if(new_steponecontractrecieved)
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item2);
} else
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item1+item2);
}   

If it does not have a value do one thing, else do something else. See my code below. This is currently not working. I'm pretty sure my if statement is incorrect but unsure how to fix

if(new_steponecontractrecieved)
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item2);
} else
{
    Xrm.Page.getAttribute("new_totalamountcollected").setValue(item1+item2);
}   
Share Improve this question edited Mar 31, 2016 at 17:14 BMergen asked Mar 31, 2016 at 14:54 BMergenBMergen 151 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Please try the code below:

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
}

本文标签: dynamics crm 2011javascript to check if a field has a valueStack Overflow