I'm trying to check if some fields on the lookup records are filled in(not null).
I have a custom lookup field on Lead to Account, let's call it Some_Account__c
. I also have a custom button on Lead and when a user clicks on it I want to make a check if all required fields are filled in(note: by required I mean that they are only required at the moment of clicking the button, so they can possibly be empty).
Here's the code snippet of that button:
if ({!OR( ISNULL( Lead.Some_Account__r.My_Custom_Field_1__c ) ,ISNULL( Lead.Some_Account__r.My_Custom_Field_2__c ))}) {
alert('please fill in the required fields');
}
So basically I check if any of those fields is empty, and if at least one of them is, I want to show an alert.
However, I get the following error:
Error: Field Lead.Some_Account__r.My_Custom_Field_1__c does not exist. Check spelling.
So the question is: can I somehow access the fields of the lookup records with JavaScript custom button?