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
John CollierJohn Collier 

select a picklist value based on an numeric amount field

We would like to use our first Process Builder to automatically complete certain fields to save the user's time as well as get better accuracy in NPSP SF for creating a new Opportunity and based on an Opportunity Type. We have Member Levels based on the Payment Amount to automatically record into a Member Level field.  I have used Help trying to find the right formula in Process Builder to do this but get an error when it finds <. 

One help topic suggested I may not be able to do this in Process Builder but here is my logic I've developed. I also assumed that going through each step would return the right Member Level without having to do a range of >=  &&  <. on each Member Level picklist value.

IF([Opportunity].npe01__Payments_Made__c >= 35, [Opportunity].npe01__Member_Level__c = "Individual", 
    IF([Opportunity].npe01__Payments_Made__c >= 60, 
    [Opportunity].npe01__Member_Level__c ="Family",
       IF([Opportunity].npe01__Payments_Made__c >= 100, 
       [Opportunity].npe01__Member_Level__c ="Supporter",
           IF([Opportunity].npe01__Payments_Made__c >= 150, 
           [Opportunity].npe01__Member_Level__c ="Sustainer",
               IF([Opportunity].npe01__Payments_Made__c >= 300, 
               [Opportunity].npe01__Member_Level__c ="Patron",
                  IF([Opportunity].npe01__Payments_Made__c >= 500, 
                  [Opportunity].npe01__Member_Level__c ="Benefactor",
                     IF([Opportunity].npe01__Payments_Made__c >= 5000, 
                     [Opportunity].npe01__Member_Level__c =" Lifetime $5000",
null)) ) ) ) ) ) 
Best Answer chosen by John Collier
Abdul KhatriAbdul Khatri
I think it's better to go like this, so you expected results
 
IF(npe01__Payments_Made__c >= 5000, "Lifetime $5000", 
    IF(npe01__Payments_Made__c >= 500, "Benefactor",
       IF(npe01__Payments_Made__c >= 300,"Patron",
           IF(npe01__Payments_Made__c >= 150, "Sustainer",
               IF(npe01__Payments_Made__c >= 100, "Supporter",
                  IF(npe01__Payments_Made__c >= 60, "Family",
                     IF(npe01__Payments_Made__c >= 35, "Individual",null)) ) ) ) ) )

 

All Answers

Abdul KhatriAbdul Khatri
I am persuming this pickllist value is only to display the level based on the payments made and not be manually used to select. Keeping this assumption why don't you use the forumla field with the same name npe01__Member_Level__c,  instead of a picklist and making a selection through some code point and click code. You can use the code above like this
 
IF(npe01__Payments_Made__c >= 35, "Individual", 
IF(npe01__Payments_Made__c >= 60, "Family", 
IF(npe01__Payments_Made__c >= 100,"Supporter", 
IF(npe01__Payments_Made__c >= 150, "Sustainer", 
IF(npe01__Payments_Made__c >= 300, "Patron", 
IF(npe01__Payments_Made__c >= 500, "Benefactor", 
IF(npe01__Payments_Made__c >= 5000, "Lifetime $5000",null)) ) ) ) ) )

Let me know if ths works for you
Abdul KhatriAbdul Khatri
I think it's better to go like this, so you expected results
 
IF(npe01__Payments_Made__c >= 5000, "Lifetime $5000", 
    IF(npe01__Payments_Made__c >= 500, "Benefactor",
       IF(npe01__Payments_Made__c >= 300,"Patron",
           IF(npe01__Payments_Made__c >= 150, "Sustainer",
               IF(npe01__Payments_Made__c >= 100, "Supporter",
                  IF(npe01__Payments_Made__c >= 60, "Family",
                     IF(npe01__Payments_Made__c >= 35, "Individual",null)) ) ) ) ) )

 
This was selected as the best answer
John CollierJohn Collier

I made the Process at least activate and work with one problem:  
I need to make the Member Level work for a range of values as in this logic, anything over $35, returns "Individual";  I think I need to apply a logical range but keep getting < as an error when saving

IF([Opportunity].npe01__Payments_Made__c >= 35 && <60, "Individual", 
IF([Opportunity].npe01__Payments_Made__c >= 60 && < 100, "Family", 
IF([Opportunity].npe01__Payments_Made__c >= 100 && < 150,"Supporter", 
IF([Opportunity].npe01__Payments_Made__c >= 150 && <300, "Sustainer", 
IF([Opportunity].npe01__Payments_Made__c >= 300 && <500, "Patron", 
IF([Opportunity].npe01__Payments_Made__c >= 500 && <5000, "Benefactor", 
IF([Opportunity].npe01__Payments_Made__c >= 5000, "Lifetime $5000",null)) ) ) ) ) )

Abdul KhatriAbdul Khatri
Was my suggestion of using formula field will not work? That will cut down you coding and ease in manitenance. Even if you used my second approach you might not need to use the range than.
John CollierJohn Collier
The 2nd suggestion worked and produced the correct membership level on each try. It is much easier and cleaner than my attempts to do a range check. This was our first attempt to use Process Builder with this being just one step we automated. I intend to work with users on some others to reduce some of their keystrokes and to enforce better data quality of the several fields we need for analysis.
Thanks for the help...and the very quck replies.
Abdul KhatriAbdul Khatri
Is that summarise that your isssue is resolved or you are still look making it work through PB. If it resovled your issue please if you be kind to mark my answer the best. Thanks