*This post is locked for comments
Hi Krithika,
In d365 microsoft has introduced formContext instead if Xrm.Page. Xrm.Page is being to be deprecated in next versions of CRM.
Below is the same code used in earlier versions of CRM.
function autoPop() {
var age = Xrm.Page.getAttribute("new_age").getValue();
if (age>=20 && age<=30)
{
Xrm.Page.getAttribute("new_agerange").setValue(0);
}
elseif(age>31 && age <=40)
{
Xrm.Page.getAttribute("new_agerange").setValue(1);
}
else
{
alert("smaller");
Xrm.Page.data.entity.save();
}
}
Regards,
Sravan.J
Hi Krithika,
-----Please try not to create duplicate threads-----
Regarding your query, the code gets the value of the field new_age and then sets the value 0 or 1 depending upon the age range i.e. if age is from 20 to 40 then set the value to 0 else if the value is from 31 and 40 then sets the value as 1. If none of the above range then saves the data.
Could you please some details on what exactly you are trying to do as something is not quite right there.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156