Hi,
I am trying to create a workflow which, when a deal is renewed, creates a new deal, and then adds line items. I have made the custom code extracting the line item information from the original deal, and then i have added an action called “Create Record” in which i copy the different properties form the original deal to the new deal.
My problem is, when creating the custom code for the new line items on the deal created by the action, that i do not have the deal ID of the new deal.
My flow looks like this, and my custom code for creating the new line item works, if i manually type in a deal ID, but i would like for the custom code to have the deal ID from the newly created deal.
Hope my explenation makes sence …
Your deal ID won’t exist until your deal is actually created. I would suggest either adding a delay to allow the deal to create and then extracting the ID or kick it over to another workflow to complete your actions, pulling the newly created deal id from there. I would probably do the latter in my opinion.
I agree with @Josh, I would use two workflows. One workflow for creating the new deal and associating to the last deal, and a second workflow for grabbing the line items from the associated, last deal and adding them to the renewal deal. By using a second workflow you allow your CCAs to easily use the renewal deal record id.
You will need to have deal-to-deal assocaition configured and ensure that the new deal is associated when it’s created.
Then you can use a second workflow that enrolls the renewal deal to retrieves the line items of the last deal and adds them to the currently enrolled renewal deal. You can use something like below to get the associated deal.
Alternatively, if you do not wish to use a second workflow, you could use a CCA to create the new deal through the API rather than the standard create record action. The api response will return the newly created deal’s record id.