
async function myFunction(executionContext){
const formContext = executionContext.getFormContext();
if(formContext.ui.getFormType() === 1) return;
formContext.ui.clearFormNotification("ID");
const id = formContext.data.entity.getId().replace(/[{}]/g, '')
let retrieve = await Xrm.WebApi.retrieveMultipleRecords('related_table_name', `?$select=[allocation_column]&$filter=_[main_table_lookup]_value eq ${id}`);
if(retrieve.entities.length > 0 ) {
const allocation_sum = retrieve.entities.reduce((acc, val) => acc.allocation_column + val , 0);
if(allocation_sum === 100) return;
}
formContext.ui.setFormNotification("text", "ERROR", "ID");
}