Hello everyone,
I have a custom territory field in the accounts entity that is a lookup to the Territory table (OOB) and we're using that field instead of the Service Territory that is OOB for some reason.
The users are required to assign a territory value for new or existing accounts but we're not making that field mandatory in the account form until they have all the information of the account they previously created.
What I need to achieve is the below:
If the user wants to create an agreement for an account that has no territory assigned in the account table and he tried to save the agreement main form, it should prevent the user to save it and throw an exception saying that:
"The CurrentAccountName does not have a territory assigned please assign a territory by clicking on (LINK OF THE ACCOUNT) here!"
The logical name of the territory field is:
territory
Can please someone provide an example of the code to achieve the above scenario to add the validation rule on the agreement form?
In addition, where this logic should be applied onLoad or onSave of the form?
Any help is highly appreciated.
Thank you!