We have a custom field named "Type of Customer" on the Company Entity, however, we would like it so that it is not possible to create new opportunities for companies with a specific type of customer. I have used the existing validation in place to stop Opportunities getting created where Company Type is Supplier, however, this isn't working and we can still make opportunities regardless of the Type of Customer.
Please see the validation below:
var company = eWare.FindRecord('Company', 'comp_primaryaccountid='+Values('oppo_primaryaccountid'));
Valid = false;
ErrorStr="You cannot create an opportunity for a company with Type A";
This has been added to the 'Validate Script' for the oppo_primarycompanyid. I'm not sure on what I may be doing wrong as to why it isn't working, please does anyone have any suggestions?
CRM Version: Sage 200 CRM 2018 R3.3