Any got a work around for data coming into workato from let’s say external but carrying a company id. How would you handle multi company? Only way I found is making either cross-company baq’s, if statements but recipes grow and grow…
Can you change company within a function (epicor function using c#) then dispose of it after you’re done returning to whatever company originally…
that’s not a lot of data to go on, but my first thought would be a branching recipe that accepts the inbound data, checks the company value, and ‘routes’ to the proper company recipe for processing.
If you are using the recipe to make API calls, the API call needs a company value so this should inherently work, even if you’re calling a function assuming the function will take a company value input when called via an API call.
I’m eager to hear what you find out b/c we’ll be in the same boat later this year.
Data coming in contains an epicor company id - GBSPR01
We then call an Epicor Function
3.1. You can only select the company you want to run the function in… resulting in a multitude of if statements for GBSPR02, GBSPR03 rather than passing the company into the function.
I have found you can do this with BAQs using cross-company and pass in the company as a parameter as baq doesn’t care as long as it’s shared/all companies but functions require a run company…
Even if you run it as GBSPR01 and pass in GBSPR02 as a variable to create the record in that company the function goes… NOPE. You’re getting this as GBSPR01…
It does make sense (mostly, but I don’t use functions via API so it’s mostly guessing).
I guess I’m missing something though. If the incoming data has the company ID, then the API call to ERP should use that value for ‘Run in’ value. If the function can only ‘Run In’ the specified company, it should not need any more company ID values and would do all of its work within that company context. Right? Isn’t that what you want it to do?
I’m seeing this process as a single encapsulated API call, per row of input, acting on a single company per row of input. And Automation Studio processes each row at a time making each API call independently. Did I miss something?
ok - I’m confusing things with our terminology differences. I don’t do this yet, so I have no direct experience. I was just hypothesizing possible solutions.
When I say the “API call to ERP”, from Automation Studio, I mean the recipe step that uses the Kinetic Connector and calls the REST API method to call the Function, for which you are passing these values in to. (not calling AS from a BPM)
I made the assumptions (1) Your Kinetic Function is single-company oriented code - and does no intercompany or multi-company actions. And (2) that a single line/packet of input data from Sports News is for a single company.
With these two assumptions, I am now assuming that the recipe will process each line of input data and make the call to the Function where the data will be processed into the proper company.
If that’s not possible, or i’m not educated enough, then we can call it a day.
The way we handle this is by making the function take company as a parameter then we use this approach. The user you are running your workato connection with would have to have impersonation access and cross company access of course.
I assume once the code has completed it will return to the parent session?
Or do I need to end the session?
It’s still annoying having to do this rather than be allowed to either pick a company from a list or enter an id and have your signatures still show up…
It’s the same with all of the BOs on Automation Studio…
The only one that doesn’t work in is in a BAQ if the BAQ isn’t global. Cause the BAQ needs to exist in those other companies. It works fine for Functions too, again the function needs to be available in that Company but as long as it is, passing in the dynamic value will change the execution context.
There are two parts to this
Recipe Setup
This requires that the function , baq etc exist in a specific company you choose. So you must pick a company from the drop down then pick the respective BAQ / Function.
Recipe Execution
As long as your BAQ / Function exists / is available in ANY given company you can change the execution context of the recipe call by using the Request Settings call and it will properly execute across multiple companies.