12-13-2023 03:07 PM
I have created a Recipe in pilot a step
gets a related list from Opportunity Products in salesforce (which is a list of all the SKUs in an opportunity)
I then have a step
Batch Sales Order in Epicor Kinetic (batch) (Which creates a Sales order and loads all the SKus)
this is super cool
BUT we have 2 different companies in Epicor so I would like to do this exact thing but say 5 of the SKUs are from company 1 and 4 are for company 2
I created a field in SFDC so the opportunity product record would have company 1 or two but I can't figure out how to get the records with the condition for company 1 or 2.
anyway to do the get with conditions? I don't see a get action that has conditions options
Solved! Go to Solution.
12-14-2023 10:30 AM
Hi! You need to create a loop and iterate over the product list retrieve. Then, in the loop you will have an if/else condition. If Product Company = 1, proceed with X. Else - proceed with Y.
X & Y executions are essentially the same. But going to different Epicor Companies.
The use case guide and activity in this module can be helpful: https://academy.workato.com/working-with-databases
12-15-2023 07:01 AM - edited 12-15-2023 07:08 AM
Ok @johnw , just a quick comment. In the proposed solution, you are iterating over each of the Opportunity Products instead of creating the Sales Order in Epicor in batch, right? This solution, depending on the number of Opporunity Products and Sales Orders may consume a large number of tasks. My question is, instead of getting all the Opportunity Products in one action, have you tried to make 2 different searches filtering by Company using one of the following actions:
If you are using the "Search records" Action (simpler), you should be able to see the newly created custom field for Company in Salesforce. Ensure that the user you are using in the Workato SFDC connection has permission to access this field. Additionally, don't forget to refresh the recipe schema.
By obtaining the results in this manner, using two separate lists, you will be able to create the Sales Order in Epicor in batches through two different actions. This approach will require fewer tasks compared to the previous method.
Regards
12-14-2023 10:30 AM
Hi! You need to create a loop and iterate over the product list retrieve. Then, in the loop you will have an if/else condition. If Product Company = 1, proceed with X. Else - proceed with Y.
X & Y executions are essentially the same. But going to different Epicor Companies.
The use case guide and activity in this module can be helpful: https://academy.workato.com/working-with-databases
12-15-2023 03:50 AM
Today I have I have a single step which will create the Sales order in Epicor as well as add all the SKUs as shown in the image below. In your suggestion when I loop through would each iteration of the loop add a product to the Sales order? (seems like this would be lots of tasks if I had a lot of SKUs on the op)
Or would I create a Workato List and just batch create using that list?
12-15-2023 04:46 AM
Some of the batch steps don't allow you to filter (because the filter would only apply to the last record in each batch). Instead, you need to retrieve all records and loop over them. Then you add the filtered items to a list and use that for a batch action. The link I shared walks through this exact use case.
12-14-2023 10:32 AM
I am not so familiar with Epicor, so throwing 2 other ideas:
1. Use 2 different recipes. However, you can't filter in the trigger so it would only work if you retrieve them later in the recipe.
2. Within the step where you batch them to Epicor, use If/then logic (based on the value from Salesforce) to set the company name. I don't know if you can batch load to separate epicor companies.
If option 2 here works, it is likely the cleanest and most scalable method.