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
nusrat khowajanusrat khowaja 

Anyone please help me in Trigger Task

i am new , and do not know how to create tigger for this task, please help me.
Thanks

Create a field called Alexa Rank in accounts and a field called size
alexa rank field = numerical
Size field has 6 values "enterprise, small mid, mid mid, large mid, and small business"
automation: update the Size field when the Alexa Rank field is updated
size alexa rank
enterprise <=100000
large mid <= 150000
mid mid <= 250000
small mid <=500000
small business >= 500000
upload a list of leads. but before you upload check the input file for fields that do not exist in the leads object. Create those fields and then upload the recoards.
upload a list of accounts. but before you upload check the input file for fields that do not exist in the leads object. Create those fields and then upload the recoards.
Best Answer chosen by nusrat khowaja
srlawr uksrlawr uk
You probably don't need a trigger to achieve the first task - you could just use a workflow rule, or even a formula field.

When the Alexa Rank field is updated, you can use a workflow rule to execute a Field Update to set the Size field based on a formula like
 
IF(Alexa_Rank__c <=100000, 'enterprise',
 IF(Alexa_Rank__c <= 150000, 'large mid',
  IF(Alexa_Rank__c <= 250000, 'mid mid',
   IF(Alexa_Rank__c <=500000, 'small mid',
    IF(Alexa_Rank__c >= 500000, 'small business','NA'
    )
   )
  )
 )
)
(the order/greater than/less than bits might need tweeking)

If you arn't sure on entry criteria (you could just use the ISCHANGED() function on the Alexa Rank you could just make it fire every time a record is updated (thus set the formula to true).

In my mind though, you could just make the "Size" field a formula field with that in it, and everytime you load the object up you will get that value based on what is in Alexa_Rank__c - not just when the field is updated (if that is a hard requirement though, do it with a workflow rule as above)

All Answers

srlawr uksrlawr uk
You probably don't need a trigger to achieve the first task - you could just use a workflow rule, or even a formula field.

When the Alexa Rank field is updated, you can use a workflow rule to execute a Field Update to set the Size field based on a formula like
 
IF(Alexa_Rank__c <=100000, 'enterprise',
 IF(Alexa_Rank__c <= 150000, 'large mid',
  IF(Alexa_Rank__c <= 250000, 'mid mid',
   IF(Alexa_Rank__c <=500000, 'small mid',
    IF(Alexa_Rank__c >= 500000, 'small business','NA'
    )
   )
  )
 )
)
(the order/greater than/less than bits might need tweeking)

If you arn't sure on entry criteria (you could just use the ISCHANGED() function on the Alexa Rank you could just make it fire every time a record is updated (thus set the formula to true).

In my mind though, you could just make the "Size" field a formula field with that in it, and everytime you load the object up you will get that value based on what is in Alexa_Rank__c - not just when the field is updated (if that is a hard requirement though, do it with a workflow rule as above)
This was selected as the best answer
nusrat khowajanusrat khowaja
Thanks , Srlawr you are genious man !!!!!!