Hi partner,
Since you have mapped some fields between your custom entity and account, you should know which fieds are mapped.
And there should be a relationship between custom entity and account.
So we chould resolve this requirement in this way.
1.Check if the two fields contain data when onloading the account form.
As you konw using "formContext.data.entity.attributes.get()" will get all the fields on the form, and if you want to get a special field's value, you could use the following code.

We could use "find" method to find the special field we need with its field name.
But there is a better way to get the field on the form, using "formContext.getAttribute()" could get the field directly and this method could also imporve the peformance cause it doesn't need to get all the fields on the form.
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/getattribute
2.Get the mapped field value in custom entity by web api.
For example, if custom data entity has an 1:N relationship with account, so there should be a custom entity lookup field on the account entity.
We could use the following code to get the related entity data by web api.
var lookupObjB = Xrm.Page.getAttribute(lookupFieldName); //Check for Lookup Object
if (lookupObjB != null) {
var lookupObjValue = lookupObjB.getValue();//Check for Lookup Value
if (lookupObjValue != null) {
var lookupEntityTypeB = lookupObjValue[0].entityType, //To get EntityName
lookupRecordGuidB = lookupObjValue[0].id, // To get record GUID
lookupRecordNameB = lookupObjValue[0].name; //To get record Name
}
}
Xrm.WebApi.retrieveRecord("EntityB",lookupRecordGuidB,"?$select=fieldnameA,fieldnameB,...").then(
function success(result) {
var fieldAInCustomEntity=result.fieldnameA;
var fieldBInCustomEntity=result.fieldnameB;
//..todo
},
function error(error) {
Xrm.Navigation.openAlertDialog({ text: error.message });
}
);
3.Compare the fields value and disable/enable the fields.
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/setdisabled
Hope it helps.
Best Regards,
Leo