Account assignment based on State with Process builder - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Rita ZakarRita Zakar 

Account assignment based on State with Process builder

Hi,

I'm building an account assignment process, which supposed to be fairly simple but my suggested solution doesn't seem to work. I have a list of shipping states which should be assigned to 1 owner all the rest to another.

I used process builder to lookup the state under shipping state and specified the criteria with the following formula:

AND(
CONTAINS("PA:DE:MD:WV:VA:NC:TN:AL:GA:SC:FL", [Account].ShippingState  ),
[Account].RecordTypeId   = "0124H000000seJg"
)

However, none of the above-specified state codes are being picked up.

Thanks for your help!!! :)
 
Best Answer chosen by Rita Zakar
Tony TrinhTony Trinh
[Account].RecordType.Name is available if you are inserting the field. The RecordType is actually a separate related object and it kinda acts like a lookup field to the RecordType object. Finding the field has the same behavior. You would need to select the "Record Type ID >" and then choose the Name field on the related Record Type record.

I would still recommend switching to the Name, but if you wanna stick with the ID, I would recommending commenting that in the formula like this:
AND(
CONTAINS("PA:DE:MD:WV:VA:NC:TN:AL:GA:SC:FL", [Account].ShippingState  ),
[Account].RecordTypeId   = "0124H000000seJgABC" /*Name of Record Type*/
)
Whatever is between the "/*" and the "*/" will not be evaluated.

All Answers

Karan KeharKaran Kehar
Hi Rita,

Are you using State and County picklists? If yes then the field which consists of Code is ShippingStateCode. Can you try modifying the criteria accordingly?
Steve MolisSteve Molis
 I notice that your RecordType ID is only 15 characters "0124H000000seJg"  the Process Builder uses the full ID-18 

Also, I try to avoid using hard coded ID's whenever possible 
User-added image

 
Tony TrinhTony Trinh
Hi Rita,

Can you use the RecordType.Name instead of the Id? I am not sure if PB recognizes the 15 character ID. I usually see it work with the 18 character one:
AND(
CONTAINS("PA:DE:MD:WV:VA:NC:TN:AL:GA:SC:FL", [Account].ShippingState  ),
[Account].RecordType.Name = "Name of Record Type"
)
Think of the baby seals (word to @SteveMo)
Tony TrinhTony Trinh
HAHA @Steve I just saw your response.
Steve MolisSteve Molis
You could also replace the CONTAINS with a CASE like this
AND(
CASE( [Account].ShippingState ,
"PA", 1,
"DE", 1 ,  
"MD", 1 ,  
"WV", 1 ,  
"VA", 1 ,  
"NC", 1 ,  
"TN", 1 ,  
"AL", 1 ,  
"GA", 1 ,  
"SC", 1 ,  
"FL", 1 ,  
0  ) = 1,
[Account].RecordTypeId   = "0124H000000seJgXYZ"
)
or 
AND(
CASE( [Account].ShippingStateCode ,
"PA", 1,
"DE", 1 ,  
"MD", 1 ,  
"WV", 1 ,  
"VA", 1 ,  
"NC", 1 ,  
"TN", 1 ,  
"AL", 1 ,  
"GA", 1 ,  
"SC", 1 ,  
"FL", 1 ,  
0  ) = 1,
[Account].RecordTypeId   = "0124H000000seJgXYZ"
)


 
Steve MolisSteve Molis
If it's just a Text field then I would use TontT's Formula, or this
AND(
CASE( [Account].ShippingState ,
"PA", 1,
"DE", 1 ,  
"MD", 1 ,  
"WV", 1 ,  
"VA", 1 ,  
"NC", 1 ,  
"TN", 1 ,  
"AL", 1 ,  
"GA", 1 ,  
"SC", 1 ,  
"FL", 1 ,  
0  ) = 1,
[Account].RecordType.Name  = "Hi My Name Is"
)

 
Rita ZakarRita Zakar
Thanks all for the swift answer. I tried to avoid using ID, but Record type name was not an option in the formula builder :( I added the full ID (18 digits) and it works now! 

Thanks again for your help! :)
Tony TrinhTony Trinh
[Account].RecordType.Name is available if you are inserting the field. The RecordType is actually a separate related object and it kinda acts like a lookup field to the RecordType object. Finding the field has the same behavior. You would need to select the "Record Type ID >" and then choose the Name field on the related Record Type record.

I would still recommend switching to the Name, but if you wanna stick with the ID, I would recommending commenting that in the formula like this:
AND(
CONTAINS("PA:DE:MD:WV:VA:NC:TN:AL:GA:SC:FL", [Account].ShippingState  ),
[Account].RecordTypeId   = "0124H000000seJgABC" /*Name of Record Type*/
)
Whatever is between the "/*" and the "*/" will not be evaluated.
This was selected as the best answer
Steve MolisSteve Molis
That's odd...  Did you use the Insert Field Button in the Formula Editor?

1
User-added image
2
User-added image
 
Rita ZakarRita Zakar
I have one more question regarding this:
The formula works perfectly, now I want to trigger this process. I created a trigger field on the object and imported a list of records with an update on the trigger field. The automation does not seem to work on bulk import, but it does, when I change a record manually. Is there any other way of triggering PB?

Thanks :)
Steve MolisSteve Molis
Can you post screenshots of your complete Process, Settings, Node, Actions? 

When you imported the data did you use the Data Import Wizard and select 

"Trigger workflow rules and processes for new and updated records"?
User-added image
Rita ZakarRita Zakar
Thanks, Steve for your reply.  It looks like it was a time-out issue on the workflow action (some records were indeed updated but many failed) and importing the records in smaller batches solved the problem! 
Steve MolisSteve Molis
No problem Rita, glad to hear that you were able to get it sorted out. 

Cheers,

SteveMo