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
RJ12RJ12 

Create a Task based on Opportunity Field

I need help to create a task based on Opportunity Field.
 
Let's say I have a picklist field in Opportunity called 'Type' with Values A, B.

 If value 'A' is selected then you must check for Synced Quote in that Opportunity related list. In the synced Quote, if the Status field is 'Rejected' then we must create 2 Tasks in the Opportunity Record with the subject line 'Task Subject 1' and 'Task Subject 2'.

I have a custom picklist field in the Task called 'Task Value' with values X, Y. 

So Tasks must be created as
Task 1:
Subject Line: Task Subject 1
Task Value: X

Task 2:
Subject Line: Task Subject 2
Task Value: Y

These 2 tasks must be displayed on the opportunity related list 'Open Activities'.
 
Marcelo CostaMarcelo Costa
I guess for this scenario, your best bet would be a Trigger (as your business rules are complex for a workflow).
Create a trigger for Opportunity if one does not yet exists (and remember, bet practices a batched one with a trigger handler) that will be executed on after update. On that would be quite straightforward... Good luck :)
Dev_AryaDev_Arya
I would go for a point+click, process builder, on the update of record, have your criteria set and add multple actions to create tasks. Tasks will go to the Activities anyways.
Nikhil Verma 6Nikhil Verma 6
Since your logic involves a check from the related Synced Quote records, you can't achieve this using a simple Process Builder or Workflow won't achieve it. You can go ahead with a trigger approach or if you want to stick to point+ click, you can use Process Builder + Flows to achieve this. Using flows, you can query records from the database and also insert/update/delete records.
Hope this helps.
RJ12RJ12

@Dev_Arya

Here we need to Create a task not to update one.