cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Process Existing Records when turning on recipe

dhs007
Deputy Chef I
Deputy Chef I

Hello community!

I am working on a recipe that syncs new/updated opportunity records created in CRM to a MAP. I have tested this recipe, and it's working as expected. However, I want this recipe to process and sync existing opportunity records in CRM to the MAP. I'm using a new or updated opportunity in CRM trigger in the recipe, which only processes records created/updated after turning on the recipe. How do I sync existing opportunity records? I set the "When first started, this recipe should pick up events from" option in the trigger before turning it on, thinking it'd pick events from the specified date-time, but unfortunately, even after setting this date, it's picking up new/updated opportunities -- not the opportunity records that were created/updated from the date time mentioned in the "When first started, this recipe should pick up events from" option. Appreciate any help in this regard. Thank you!

5 REPLIES 5

gary1
Star Chef I
Star Chef I

It sounds like you overlooked the need to true-up the MAP before starting your steady state process. You could touch all records in the CRM resulting in each record triggering your recipe, but that may produce undesirable data in the CRM. Or, you can create a new recipe that queries records from the CRM and then processes them.

The "When first started..." timestamp is applied to events that are received after Workato creates the webhook. If the webhook was created on Wednesday, it won't be able to process events prior to Wednesday because the webhook wasn't present.

As a design principle, I suggest always creating two recipes when working with application triggers/webhooks. The first recipe receives the trigger from the calling system, and then it calls a second function recipe to do the "work".  This allows you to call the function recipe from elsewhere, meaning you could call it when the first recipe receives an event, or you could make a third recipe that queries for a bunch of records and submits them each to the function recipe for processing. This is how I would work my way out of your situation.


Or, you can create a new recipe that queries records from the CRM and then processes them.

Thanks! How to go about creating this recipe? This won't be a trigger, of course, right? FYR, I am trying to sync NetSuite Opportunities to HubSpot as deal records.

When creating a recipe there's a recipe type called a "Function Recipe". Use that one.

Once the function recipe exists, use a "function" action in the first recipe to call the function recipe.

You can configure the function recipe to require certain input. Recipe 1 could either hand off the entire payload to Recipe 2, or you can "double dip" by having recipe 2 query NetSuite to get all of the data for the calling record again.

The general flow looks something like this:

  1. Recipe 1 receives the event from NetSuite
  2. Recipe 1 calls Recipe 2 with the NetSuite ID 
  3. Recipe 2 queries the NetSuite record using the ID (this is the "double dip")
  4. Recipe 2 syncs the data to HubSpot

Here are some other steps to help you along:

  • Your existing recipe already does all the processing, so you should clone this recipe, and update the trigger in the clone to be a function call. This is what makes it a function recipe that can be called from another recipe
  • Doing this will break a lot of the mapping in your recipe because your recipe is probably using a lot of data that is coming from the NetSuite webhook. This is where you have the choice of sending all of the data from recipe 1, or simply querying the record again from within recipe 2 (this option is MUCH easier).
  • Once recipe 2 is all cleaned up, your function recipe is ready. Now delete all actions in recipe 1 (keep the trigger), and add the function call for recipe 2.

 

This is helpful, but how would I query the existing opportunity records in NS? That's still unclear.