+ Start a Discussion
Ajay LAjay L 

CPU timeouts with validation rule

Hello,

Can anyone help me on this validation rule causing CPU timeouts. When load the data through dataloader this validation is causing the CPU time out error, if I deactivate this rule and the load is success with no CPU timouts. I tried multiple times and noticed the same results. Is there a betterway we can write this validation rule?

AND ( 
OR($Profile.Name <> "API Integration", $Profile.Name <> "USA Sales Planning Rep",$Profile.Name <> "USA Sales Planning Executive",$Profile.Name <> "USA Sales Planning Mgr",$Profile.Name <> "API Eloqua" ), 
OR( 
ISBLANK( BillingCity ), 
ISBLANK( BillingStreet ), 
ISBLANK( BillingCountry), 
ISBLANK( BillingState), 
ISBLANK( BillingPostalCode ) 

)
Best Answer chosen by Ajay L
Suraj PSuraj P
I'm just looking at the rule you posted again. The first part of your rule would always fail, since $Profile.Name can only be one of the values you posted at any given time. Hence the first OR condition would always return true, and is virtually pointless. Are you trying to validate for profiles other than the ones you've mentioned here? If so, this should work:

AND ( 
NOT(REGEX($Profile.Name ,"API Integration|USA Sales Planning Rep|USA Sales Planning Executive|USA Sales Planning Mgr|API Eloqua" )), 
OR( 
ISBLANK( BillingCity ), 
ISBLANK( BillingStreet ), 
ISBLANK( BillingCountry), 
ISBLANK( BillingState), 
ISBLANK( BillingPostalCode ) 

)

All Answers

Suraj PSuraj P
maybe try 
AND ( 
REGEX($Profile.Name ,"API Integration | USA Sales Planning Rep | USA Sales Planning Executive | USA Sales Planning Mgr | API Eloqua" ), 
OR( 
ISBLANK( BillingCity ), 
ISBLANK( BillingStreet ), 
ISBLANK( BillingCountry), 
ISBLANK( BillingState), 
ISBLANK( BillingPostalCode ) 

)
Ajay LAjay L
Hi Suraj,

Thanks for your reply, however validation rule is not firing for other profiles:(

Any suggestions please?

Regards,
Ajay
Suraj PSuraj P
My bad. There shouldn't be any spaces.

AND ( 
REGEX($Profile.Name ,"API Integration|USA Sales Planning Rep|USA Sales Planning Executive|USA Sales Planning Mgr|API Eloqua" ), 
OR( 
ISBLANK( BillingCity ), 
ISBLANK( BillingStreet ), 
ISBLANK( BillingCountry), 
ISBLANK( BillingState), 
ISBLANK( BillingPostalCode ) 

)
Ajay LAjay L
Thanks Suraj for quick followup,

I did the changes as you suggested above. Being a sys admin user, I should get the error if I create or edit the record without Billing address. For some reason the validation is not firing.

Am I doing anything wrong?

Regards,
Ajay
Suraj PSuraj P
I'm just looking at the rule you posted again. The first part of your rule would always fail, since $Profile.Name can only be one of the values you posted at any given time. Hence the first OR condition would always return true, and is virtually pointless. Are you trying to validate for profiles other than the ones you've mentioned here? If so, this should work:

AND ( 
NOT(REGEX($Profile.Name ,"API Integration|USA Sales Planning Rep|USA Sales Planning Executive|USA Sales Planning Mgr|API Eloqua" )), 
OR( 
ISBLANK( BillingCity ), 
ISBLANK( BillingStreet ), 
ISBLANK( BillingCountry), 
ISBLANK( BillingState), 
ISBLANK( BillingPostalCode ) 

)
This was selected as the best answer
Ajay LAjay L
It worked perectly. Thanks Suraj.

It actually improved the performance.

Reagrds,
Ajay