Hello everybody, As you probably know, the Xrm.Page command usage is slowly becoming obsolete. That's why we wanted to adapt to the new orders. I created a simple JS to hide a field with the condition that another field is not filled. In the old model, the code works without problems. But as soon as I swap Xrm.Page through ExecutionContext.getFormContext in the code I get a script error while executing. What am I doing wrong ? can someone tell me what my mistake is and how does it work? Here is the old code:
function versteckeFeld(){
if (Xrm.Page.getAttribute("salutation").getValue() == null)
{var name = Xrm.Page.ui.controls.get("new_geschlecht");
name.setVisible(false);}
else
{var name = Xrm.Page.ui.controls.get("new_geschlecht");
name.setVisible(true);}
}
Here is the new code:
function versteckeFeld(){
if (ExecutionContext.getFormContext.getAttribute("salutation").getValue() == null)
{var name = ExecutionContext.getFormContext.ui.controls.get("new_geschlecht");
name.setVisible(false);}
else
{var name = ExecutionContext.getFormContext.ui.controls.get("new_geschlecht");
name.setVisible(true);}
}
Please Help me ^^
I thank you in advance Many greetings :)
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (