Update fields of one entity using workflow of another

By | August 9, 2011

Workflow in Sage CRM is one of the best functionalities to have not only for a visual description of a Business process but also to set up predefined rules and actions to suit the business process.

In a scenario where the client wanted to update a field comp_type in Company based on the Workflow rule in Opportunity entity, the first method which I tried was by creating a rule in the workflow, selecting the Table or view as Company and creating a workflow action Set Column value, where I set the field comp_type to a static value, say “customer”. But this method did not work since we cannot update another entity field directly by selecting Table or view as Company in a workflow.

To achieve the same I tried another method by selecting Table or view as Opportunity and creating a workflow action type Execute Sql Statement. In the sql statement block I added the below query

Update company set comp_type = ‘customer’ where comp_companyid = #oppo_primarycompanyid# and it worked!

However this would only work if you have fixed values to be set in the other table. In case these values need to be dynamic then you will have to user a custom ASP page where you can write your own logic to set the values to the field.

If you find this content useful, please drop us an email at crm@greytrix.com.