Is there a way to call an asynchronous function from a synchronous function without encountering issues?
function showOpenCaseDialog(): boolean {
let result = false;
var regardingobjectid = (<Xrm.LookupAttribute<string>>Xrm.Page.getAttribute("regardingobjectid")).getValue();
if (regardingobjectid != null && regardingobjectid.length > 0) {
var regardingobject = regardingobjectid[0];
if (regardingobject.entityType === "incident") {
checkCaseLastOpenActivity(regardingobject).then(x => result = x);
}
}
return result;
};
The function checkCaseLastOpenActivity is asynchronous in nature.
One issue encountered is that the synchronous function returns a value before the asynchronous operation is completed.
Are there any potential solutions to this problem?