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