Hi Chrisbra22,
You need to write some similar functions to solve your problem and bind it in a custom rule.
function fn1 (_accountid) {
try {
var isVerifiedBankDonorOrganization = false;
var fetchData = {
verifiedbankdonor: "1",
accountid: _accountid
};
var fetchXml = [
"",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"",
].join("");
otherChanelImport.Retrieve(globalVariables.WebAPIVersion, "accounts", fetchXml);
if (globalVariables.Results.length > 0) {
isVerifiedBankDonorOrganization = true
}
} catch (e) {
var alertStrings = { confirmButtonLabel: "OK", text: "Error from IsVerifiedBankDonorOrganization: " e, title: "Error" };
var alertOptions = { height: 200, width: 500 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then();
}
return isVerifiedBankDonorOrganization;
};
function Retrieve(webAPIVersion, entitysPluralName, fetchXmlQuery) {
try {
//GET[Organization URI/api/data / v9.0/ EntityDefinitions(LogicalName = 'account') ? $select = DisplayName,IsKnowledgeManagementEnabled, EntitySetName HTTP/ 1.1
//Accept: application / json
//OData - MaxVersion: 4.0
//OData - Version: 4.0
var req = new XMLHttpRequest();
req.open(
"GET",
Xrm.Page.context.getClientUrl()
"/api/data/" webAPIVersion "/" entitysPluralName "?fetchXml="
encodeURIComponent(fetchXmlQuery),
false
);//Sync
req.setRequestHeader("Prefer", 'odata.include-annotations="*"');
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response);
globalVariables.Results = results.value;
} else {
alert(this.statusText);
}
}
};
req.send();
} catch (e) {
var alertStrings = { confirmButtonLabel: "OK", text: "Error from Retrieve: " e, title: "Error" };
var alertOptions = { height: 200, width: 500 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then();
}
};
If I answer your question then please mark it as verified.
Let me know if I can provide you with more details.
Thanks
Regards,
Abdul Wahab
Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp: 923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: www.linkedin.com/.../