Brilliant. Splitting it up with separate triggers was the key.
- Method Directive on Customer Update: Call the MCD function if the
GlobalCustof all rows isTrue. - Data Directive on GlbCustomer Table: Call the linking function if the
CustNumof the changed row is0and theGlbCompanyof the changed row is equal to the [parent company].
If there is interest, I can post details of the functions once I’ve had some time to clean them up and do more testing.
To circle back to the original post, it is possible to trigger the Multi Company Direct Server Process using a function with only widgets, so no coding is required:
- Do a trace of your typical Multi Company Direct Server Process to get the parameters you pass in your environment.
- Create a new Library in Function Maintenance.
- In “References,” add
ERP.Proc.MultiCompanyDirectto services and addSysAgentin tables (you might not need to includeSysAgentbut you need something to be able to fill a variable table). - In “Security,” add all companies that will need to participate.
- Create a new function.
- In the function designer, first add an “Invoke BO Method” for
erp.multicompanydirect.SubmitToAgent.
- For the “ds” binding, select “Create new variable” and name it.
- The remaining parameters can be determined from the bottom of your trace, but you can set the “mainProgram” to an expression to identify that it was called by a function.
- Add a “Fill Table by Query” setter and set the “specified table” to the ds variable you created in the BO method.
- In the Query, add the
ICE.SysAgenttable and in the Display Fields, add theAgentID(this could be anything; it isn’t actually used). - In the mapping section, set the values to match the values from your trace. Ensure
ContinuousisfalseandTenantModeistrueto have it process on all companies. - Link Start > Fill Table > Invoke BO Method
I’m still in the testing process, but this has worked so far.
Thanks for all the help, automating the Global linking process has been on everyone’s wish list here since we started using it, and this might actually get us there.