Home > Forum > Tips&Tricks > Change Business Entity

Change Business Entity
0

Hello everyone,

in a webcon environment I currently have two business entities (ID 1 and 4, see the attached screenshot).
From now on I only want to use the entity with ID 4.
Is there a known way to migrate all existing instances from ID 1 to 4 so I can delete the business entity with ID 1 afterwards?

MVP

Hi Tim,

I have no better idea than creating a CustomAction.
The parameter type 'RunCustomActionParams' has a 'CurrentDocument' which has an UpdateDocumentCompany function:
RunCustomActionParams.Context.CurrentDocument.UpdateDocumentCompany

Unfortunately the type returned by DocumentsManager does not have this option.
(WebCon.WorkFlow.SDK.Documents.DocumentsManager.GetDocumentByID(1))

So you would need to add this action to each workflow.

At least this way uses supported means, no direct modification of the SQL table. :)

Remark: I haven't tested this. But the function signature looks good.
UpdateDocumentCompany(int newCompanyID);

Best regards,
Daniel

MVP

Unfortunately, Daniel is right, and there is no action to do this on the shelf. We should also suggest an action like this in the User voice section. For example, we had a customer (a government entity) that had a business entity for each county (42 of them). They wanted to function as independent entities in webcon. Still, sometimes people would "start" instances for a county, and that specific business entity would wish to transfer that instance to another business entity.

Changes to the database are unsupported. I didn't know about that SDK function, but that info is definitely useful.