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
arjuna Rajput 29arjuna Rajput 29 

CREATE FLOWS AND TRIGGER THAT we have account with field name salary and category field in salesforce then when a user enter the salary it get automatic detect that that salary value belong to category a b and c

Best Answer chosen by arjuna Rajput 29
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,
Cont....
User-added image
Entire Flow:

User-added image
Activate the flow and test it.

If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Saurabh,

You want both flow and Trigger? And how to detect the category a,b and c. Can you specify the ranges.

Thanks,
 
arjuna Rajput 29arjuna Rajput 29
Yes Both flows and trigger
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Saurabh,

Can you try the below flow and trigger.

Trigger:
 
trigger AccountCategory on Account (before insert,before update) {
    
    For (Account acc:Trigger.new){
        
        if(acc.salary__c <=10000)
            acc.category__c='sample1';
        
        else if (acc.salary__c>10000 && acc.Salary__c<=100000)
            acc.Category__c='sample2';
        else
            acc.Category__c='sample3';
    }

}

Flow:

Create a record triggered flow on account object as below.

User-added image
Decision1:

User-added image
Update element 1:

User-added image
Decision2:

User-added image
Update 2:
User-added image
 Continued in next comment
 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,
Cont....
User-added image
Entire Flow:

User-added image
Activate the flow and test it.

If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer
arjuna Rajput 29arjuna Rajput 29
thanks praveen appreciated your work you are mention sample 1 and sample 2 these are the category 
Sai PraveenSai Praveen (Salesforce Developers) 
Yes Saurabh,

Those are the different values i have created in Category picklist. Replace them as per your requirement.

Thanks,
 
arjuna Rajput 29arjuna Rajput 29
yes that means when i create category field that field datatype should be picklist