Hi, I am trying to sync data between the master companies of our different stages test, prelive, live using configuration packages and a direct API.
( Specifically the fucntion ImportPackageXMLWithCodeFromStream in Codeunit "Config. XML Exchange" ). That function doesn't work cross-company.I created an API but unfortunately it only ever applies the package to the current company.
So right now my approach is:
Save relevant data in a buffer table.
startSession in the new company.
retrieve & apply the package data.
Is there a easier way to change the company while keeping the package data ( large string )?
I think you must be having a full license and hence a free power automate license too (Given by Microsoft with Essential or premuim).
So what you can do I think is set up a manually triggered Automate workflow using Business Central triggers and actions where you can do the following steps. I am putting some help links at the end to create power automate flow.
1 - Retrieve the Config Package Record and its content from the Source Company and environment.
2 - Now you can run a loop for the number of environments you want to copy your data.
3 - In each loop you can list the companies with the Get Companies API. (The name of the API can be different, you need to check).
4 - With this create another loop to insert a record in each of this companies.
5 - Run action "Import".
If no error and clean data this should automate your work. I've not tried it but thanks to your idea now I can do it. Now this flow you can also run through HTTP Call to Power Automate. Check HTTP trigger in Power Automate - Trigger Power Automate Flow Through Business Central Action.
Now you can also do the same thing by creating a report in Business central which does the same thing by creating the same loop and API calls and Web Action calls.
I know I am explaining on high level, but if you managed to find Config Package API, I think you can understand the above explanation too.
Let me know if you have any question. Mark answer verified if this helps.
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.