How do I assign Salesforce leads to users based on company name range?
I have a webform for prospects to fill out. Based on the name of the company they enter I want to assign the lead to a specific Salesforce user. I want to designate a range of company names “alpha - alpha (ie “A - K”) without have to use the OR command and create 11 individual statements. Is there a way to simply say from this letter to this letter? I also tried filters however, filters do not have “alpha/letters greater than” in the conditions dropdown box.
Thank you!
Page 1 / 1
Hi @Knowi
Good question.
Check out the options for using a Lookup Table:
Lookup table is your way to resolve this @Knowi
Hi @Troy Tessalone,
I dont understand how a lookup table would work. The company name input on the webform can be any of thousand of different companies. If I understand the theory of a lookup table, I would have to list all the possible input values prior and then say if the value is in the table then do something. That is not viable in this case. I can not be the first person with such a request :)
@Knowi
In Zapier, creating a condition based on a range of alphabets (like company names starting from A-K) without using multiple "OR" conditions can be a bit tricky because Zapier doesn't natively support alphabetical range conditions in its standard filter setup. However, you can achieve this by using a bit of custom logic with a "Code by Zapier" action.
I can write a code to get this done
@Knowi
Create a lookup table with each letter from A>Z assigned to the desired lookup value.
Then in the Zap add this step: Formatter > Text > Truncate
Set the max length to 1, which will give you the first letter of the input value.
Then you can use the 1 letter to lookup the matching letter in the lookup table to get the corresponding lookup value.
@communitymember so you are saying I have to use the Code by Zapier widget to inject something like:
let companyName = inputData.companyName; let assignedUser;
if (!isNaN(companyNamem0]) || companyNamem0].toUpperCase() <= 'K') { assignedUser = 'SalesforceUserID1'; // replace with the Salesforce User ID for the first range } else { assignedUser = 'SalesforceUserID2'; // replace with the Salesforce User ID for the second range }
output = {assignedUser: assignedUser};
@Knowi
You can try asking ChatGPT for help with the code.