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
Shauna Davies 72Shauna Davies 72 

I need Trigger to update a lead owner

I have two lead queues:  
Reassignment Queue    00G00000006t3ZFEAY
Content Syndication and Events Queue    00G00000006skVdEAI

I am trying to write a trigger to evalute when a Lead is in the Content Syndication and Events que, and reaches >80%, it is reassigned to the Reassignment queue.

IF
(AND(NOT ISBLANK([Lead].Lead_Insights_Value__c ),
[Lead].Lead_Insights_Value__c   > 80,
[Lead].OwnerId = '00G00000006skVdEAI')
update [Lead].OwnerId = '00G00000006t3ZFEAY')

Is my syntax correct?
 
Best Answer chosen by Shauna Davies 72
Shauna Davies 72Shauna Davies 72
Turns out there is a "Score" OBJECT, and we needed to build out the workflow on THAT object and not the lead object where the scores are shown.  Once the workflow was build on the "SCORE.Intelligence" object, and we added in an E-mail notification, the workflow seems to work.

All Answers

devloper sfdcdevloper sfdc
try to use workflow rule
Shauna Davies 72Shauna Davies 72
That doesn't work, because it will only evaluate the criteria upon creation or edit.  Einstein evaluates and scores hourly.  Unless we do a mass update editing and saving (Kicking off the workflow) the rule will not work.  That is a manual process to kick off automation and that does not make sense.

I called SF Help, and the "Apex Trigger" was the solution that Victor Balucio gave me.
devloper sfdcdevloper sfdc
"Lead_Insights_Value__c " This is a custom field and why you need this field and which type value you are enter in this field
Shauna Davies 72Shauna Davies 72
It's a "Custom Field" that Salesforce creates with you install Einstein Analytics.  It is a number field for the Einstein Analytics Lead Score.
Shauna Davies 72Shauna Davies 72
Turns out there is a "Score" OBJECT, and we needed to build out the workflow on THAT object and not the lead object where the scores are shown.  Once the workflow was build on the "SCORE.Intelligence" object, and we added in an E-mail notification, the workflow seems to work.
This was selected as the best answer