You need to sign in to do that
Don't have an account?
Amit Vaidya
Validation rule to validate if user with profile updates/creates contact
How to validate using validation rule that if a user with profile: Sales User or Sales User - SpringCM updates/creates a contact, and email != null: require that at least one of the checkboxes is checked for fields:
HasOptedOutOfEmail
Stream_Opt_In__c
Invite_Opt_In__c
Newsletter_Opt_In__c
Please help me in this.
HasOptedOutOfEmail
Stream_Opt_In__c
Invite_Opt_In__c
Newsletter_Opt_In__c
Please help me in this.
- $Profile.Id will give the Current user's profile,
You can have a logic like
If (
AND (profile id = sales user profile id ,
Email = null ,
HasOptedOutOfEmail = false ,
Stream_Opt_In__c = false ,
Invite_Opt_In__c = false ,
Newsletter_Opt_In__c = false )
)
If this meets the criteria then it will throw the Validation error else will save the record.
Regards,
Ashish
All Answers
- $Profile.Id will give the Current user's profile,
You can have a logic like
If (
AND (profile id = sales user profile id ,
Email = null ,
HasOptedOutOfEmail = false ,
Stream_Opt_In__c = false ,
Invite_Opt_In__c = false ,
Newsletter_Opt_In__c = false )
)
If this meets the criteria then it will throw the Validation error else will save the record.
Regards,
Ashish
Thank you for helping on this.
I have just modified it by removing 'if' according to my requirement. Please let me know if it correct:
AND (
OR
(
$Profile.Id = "sales user profile id",
$Profile.Id = "sales user profile id"
),
Email != null,
HasOptedOutOfEmail = false,
Stream_Opt_In__c = false,
Invite_Opt_In__c = false,
Newsletter_Opt_In__c = false
)
I have created this validation rule on both Contact and Lead object.
Please let me know if I am going wrong anywhere.
Thank you,
Amit
I had given the blue print - your's seem correct to your business logic.
Try that out and see, in your Dev / Sandbox org input few dummy records and see if that throws the Validation error as expected.
Reply back if you have any further questions.
Regards,
Ashish