I am new to CRM so I can not solve the following.
I have a custom entity "Books". I have a field which is "numberofpages_prefix" integer, what I am trying to do is set the value of another option set field " complexity" with three options "easy" ,"medium" , "hard" depending on the number of pages entered. My event is set onChange and I keep getting the last else statement which is an error message instead of the options. I tried removing the else statement but I am still not getting the value set. Help would be very appreciated.
Here is my code:
function complexityChange ()
{
var pagesNumber = Xrm.Page.getAttribute("sonade_numberofpages").getValue();
var setComplexity = Xrm.Page.getAttribute("sonade_c");
if (pagesNumber > 0 && pagesNumber <= 99)
{
setComplexity.setValue("Easy");// also tried with the option value
}
if(pagesNumber > 99 && pagesNumber <= 299 )
{
setComplexity.setValue("Medium");// also tried with the option value
}
if(pagesNumber > 299)
{
setComplexity.setValue("Hard"); // also tried with the option value
}
else
{
Xrm.Page.getControl("sonade_numberofpages").setNotification("Pages number invalid");
}
}
*This post is locked for comments
I have the same question (0)