Hope someone can help with this. I know how to set a field value on a form and it works in a way. My query is around the fact that it only works if I put this line below into the form load event as a line by itself.
Xrm.Page.getAttribute('cal_entrynumber').setValue(1.01);
However, in reality I need to have some conditional checks before I set this value and when I put this line into those conditional checks, then what I notice is that the textbox is blank but if I look at the value in the data entity it does indicate it has the value of 1.01.
alert("No. in entity:" + Xrm.Page.data.entity.attributes.get('cal_entrynumber').getValue());
So I wanted to know if anyone can pinpoint me to anything that potentially might be the cause for this ... here is the code in which the line sits (and doesnt work).
var queryString = "?$select=cal_EntryNumber&$filter=cal_SafetyProgrammeNo eq '" + spNo + "'&top=1&$orderby=cal_EntryNumber desc"; SDK.REST.retrieveMultipleRecords( "cal_operation", queryString, function (results) { //alert(results.length); if (results.length == 0) { //var entry = 1.01; //alert("Entry No:" + Number(entry)); Xrm.Page.getAttribute('cal_entrynumber').setValue(1.01); } else { // Code to go here. } }, errorHandler, function () { // OnComplete handler } );
*This post is locked for comments