Question

How do I assign Salesforce leads to users based on company name range?

  • 17 October 2023
  • 9 replies
  • 61 views

Userlevel 1

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!


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

9 replies

Userlevel 7
Badge +14

Hi @Knowi 

Good question.

Check out the options for using a Lookup Table:

 

Userlevel 3
Badge +2

Lookup table is your way to resolve this @Knowi 

Userlevel 1

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 :)

Userlevel 3
Badge +2

@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.

Userlevel 3
Badge +2

I can write a code to get this done

Userlevel 7
Badge +14

@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.

 

Userlevel 1

@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(companyName[0]) || companyName[0].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};
 

Userlevel 7
Badge +14

@Knowi 

You can try asking ChatGPT for help with the code.

  • Writing
  • Optimizing
  • Commenting
  • Troubleshooting
Userlevel 3
Badge +2

@Knowi something like that exactly -