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
azar khasimazar khasim 

Validation Rule: When Lead Owner is Call Center and Inbound Call checkbox is false u cannot edit Source, Lead Source, Channel Fields.

Hello Everyone,
Need help in creation of validation rule.

When Lead Owner is Call Center Agent and Inbound Call checkbox is false you(Call Center Agent) cannot edit Source, Lead Source, Channel Source Fields.

Lead Owner Role: Call Center Agent
Lead Field : Inbound_Call__c
Lead Fields not to get update when Inbound_Call__c is false and Owner Role is Call Center Agent.


Lead Fields not to get update.

Channel :    Channel__c(Picklist) 
Source :      Source__c(Picklist) Dependent on Channel.
Campaign Source: DC_Campaign_Source__c(Picklist)Dependent on Source
Lead Source :   DC_Lead_Source__c(Picklist) Dependent on                                          Campaign Source


Validation Rule is required to show a message that
if
Lead Owner role is Call Center Agent
Field Inbound_Call__c is false
then you(Call Center Agent) cant update these fields.


Please help me for this Validation rule.

Thanks and Regards,
Azar Khasim.
 
Best Answer chosen by azar khasim
SarvaniSarvani
HI Azar,

Please try with below code. This prevents the roles Call Center Agent or Call Center Lead Agent changing the fields when the previous value is blank and inbound call is true.
 
AND(
OR($UserRole.Name ='Call Center Agent',$UserRole.Name ='Call Center Lead Agent'),
Inbound_Call__c=True) &&

(
(( TEXT(Channel__c) != TEXT(PRIORVALUE(Channel__c))) && NOT(ISBLANK(TEXT(PRIORVALUE(Channel__c))))) ||
(( TEXT(Source__c) != TEXT(PRIORVALUE(Source__c)))&& NOT(ISBLANK(TEXT(PRIORVALUE(Source__c)))))||
(( TEXT(DC_Campaign_Source__c) != TEXT(PRIORVALUE(DC_Campaign_Source__c)))&&NOT(ISBLANK(TEXT(PRIORVALUE(DC_Campaign_Source__c)))))||
( (TEXT(DC_Lead_Source__c) != TEXT(PRIORVALUE(DC_Lead_Source__c)) && NOT(ISBLANK(TEXT(PRIORVALUE(DC_Lead_Source__c)))) ))
)

Hope this helps!

Thanks

All Answers

SarvaniSarvani
Hi Azar,

Please try below formula for your validation rule on lead object: Cross check your Role name as Call Center Agent and API names of fields.
 
AND($UserRole.Name ='Call Center Agent', 
Inbound_Call__c=false) && 

(
( TEXT(Channel__c) != TEXT(PRIORVALUE(Channel__c))) ||
( TEXT(Source__c) != TEXT(PRIORVALUE(Source__c)))||
( TEXT(DC_Campaign_Source__c) != TEXT(PRIORVALUE(DC_Campaign_Source__c)))||
( TEXT(DC_Lead_Source__c) != TEXT(PRIORVALUE(DC_Lead_Source__c)))
)

Add your error message "If Lead Owner role is Call Center Agent Field Inbound_Call__c is false then you(Call Center Agent) can't update these fields", to the top of your page.

Hope this helps! Please mark as best if it does.

Thanks
azar khasimazar khasim
Yes Sarvani,
Its Working.
Need to update with new criteria.

When User Role is Call Center Agent or Call Center Lead Agent and InboundCall is True.

then 
 If Any of the Fields are blank then only those fields they can edit it.


Lead Fields not to get update.if they are not blank.
If blank only that field needs to be in Edit mode, Remaining are all in Readonly Mode.

Channel :    Channel__c(Picklist) 
Source :      Source__c(Picklist) Dependent on Channel.
Campaign Source: DC_Campaign_Source__c(Picklist)Dependent on Source
Lead Source :   DC_Lead_Source__c(Picklist) Dependent on   Campaign Source



Need to update this Validation Rule:


AND($UserRole.Name ='Call Center Agent',
Inbound_Call__c=false) &&

(
( TEXT(Channel__c) != TEXT(PRIORVALUE(Channel__c))) ||
( TEXT(Source__c) != TEXT(PRIORVALUE(Source__c)))||
( TEXT(DC_Campaign_Source__c) != TEXT(PRIORVALUE(DC_Campaign_Source__c)))||
( TEXT(DC_Lead_Source__c) != TEXT(PRIORVALUE(DC_Lead_Source__c)))
)

Please provide me a solution.

Thanks and Regards,
Azar Khasim.
SarvaniSarvani
HI Azar,

Please try with below code. This prevents the roles Call Center Agent or Call Center Lead Agent changing the fields when the previous value is blank and inbound call is true.
 
AND(
OR($UserRole.Name ='Call Center Agent',$UserRole.Name ='Call Center Lead Agent'),
Inbound_Call__c=True) &&

(
(( TEXT(Channel__c) != TEXT(PRIORVALUE(Channel__c))) && NOT(ISBLANK(TEXT(PRIORVALUE(Channel__c))))) ||
(( TEXT(Source__c) != TEXT(PRIORVALUE(Source__c)))&& NOT(ISBLANK(TEXT(PRIORVALUE(Source__c)))))||
(( TEXT(DC_Campaign_Source__c) != TEXT(PRIORVALUE(DC_Campaign_Source__c)))&&NOT(ISBLANK(TEXT(PRIORVALUE(DC_Campaign_Source__c)))))||
( (TEXT(DC_Lead_Source__c) != TEXT(PRIORVALUE(DC_Lead_Source__c)) && NOT(ISBLANK(TEXT(PRIORVALUE(DC_Lead_Source__c)))) ))
)

Hope this helps!

Thanks
This was selected as the best answer
azar khasimazar khasim
Thank you Sarvani,
it is working from my end.
It's very helpful from your side.
Best Answer.