function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roshan singh 21Roshan singh 21 

how to validate opportunity if Account is lookup and need to compare selected account country with license object county

Hi All,
My current scenario I got stuck. please help me 
I am an opportunity object where Account is lookup field. and now i want to validate account county field with licence object country filed that is not directly related to Account object.
But  User object is having a relationship with License object. user and license having one to one relationship
now when the user is trying to create opportunity and selecting an account then I need to write validation if selected account country is same as User ->licence object country field then the only user can create the opportunity else throw an error. 

Object details:
       1. user
       2. License
       3. Opportunity 
       4. Account

now licence is having country__c field and account is having Shippingcountry field I need to write a trigger to throw an error.
Please help me it's very urgent 

Thanks in advance
Amit