i am trying frame this below code , when i am returing value into the 1st function i am getting process as undefined , can anyone guide me how to achive it.
dnd.Webresources.Application = {
ProcessValidation : false,
SupportedApplicationReadOnly : function(executionContext) {
var formContext = executionContext.getFormContext();
var businessunitId = formContext.getAttribute("dnd_applicationrootbusinessunit").getValue()[0].id;
businessunitId = businessunitId.substring(1, businessunitId.length - 1);
// To get child record count //
var process = dnd.Webresources.Application.Process(businessunitId);
alert(process);
},
Process: function (businessunitId) {
var query = "?$expand=dnd_businessunit_dnd_process_businessunit($select=dnd_processid)";
Xrm.WebApi.online.retrieveRecord("businessunit", businessunitId, query).then(
function success(results) {
var businessunitid = results["businessunitid"];
if (results.dnd_businessunit_dnd_process_businessunit.length > 0) {
return true;
} else {
return false;
}
},
function (error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
}
regards,
vinay
Hi ,
This is due to Asynchronous call as now days most of the browser does not support (deprecated)client side Synchronous call. So try to write code in the same function instead of calling different method. And inside success method do your operation by getting the value.
If I am not wrong seen your another post hiding ribbon button ,I have given you sample blog reference written by Andrew Butenko , which should work for you.