- How we work
How to Update Sales Unit Based on the Value of Custom Field in Sales Documents in SAP C4C? (workflow rules)
Let’s say you have a mandatory custom field in your opportunity and you need to automatically select a specific sales unit based on the value of this field. There is an easy way how to do it – thanks to the workflow rules feature.
Prerequisite: Custom field is already created (You can find the guide here).
Step-by-step guide for setting the workflow rule
- Go to Administrator workcenter – Workflow Rules view – click on New:
- A 5-step wizard will open, first, you need to define basic info of your rule: name, context, and timing, when selected, click on Next:
- In the second step define conditions for the rule – here you have to select your custom field and its value on which the sales unit is based. Of course, you can add more than one condition. For creating condition click on Add Group and then select your field from the list and condition value:
- The third step is the definition of the action, there is a lot of Rule types, from E-mails, notifications to field updates. In our case – we want to update value of sales unit field, so choose Rule type – Field Update and then click on Add to select the field:
- Find the desired sales unit from the list and click on OK and Next:
Important note: There are limitations of available standard fields that can be updated based on the document type, e.g. „sales unit“ standard field is not available for sales quotes and sales orders. Hopefully, SAP will extend this list in the future. The only workaround right now is creating your own custom field for the Sales Unit, because all custom fields for objects are available for updates.
- In the Review step, you can see details of your rule and Activate it – Activation is necessary to make it usable, after activation, click on Finish:
- In the last step, you can create a new rule or close your newly created one. Remember, you have to create one rule for one value, so now is a good time for repeating the whole process for another value, if needed:
Now you have your workflow rule complete. Good job! Let’s test it. I have the opportunity with my custom field „KUT test“ empty, and you can see the sales unit is „Sales Unit US“, so I‘ve selected the value of the field to „X“ and saved the opportunity:
After the opportunity is saved, the workflow rule is applied and changed the sales unit to „Sales Unit 01“ (= 2001_01 technical name used in setting the workflow rule) so it’s working just fine!
Important note: Don’t forget that the first determination rule for involved parties is that they are inherited from predecessor document, so if you create a sales quote or order from the opportunity, the same sales unit will be also automatically selected there (so theoretically another workaround is creating custom field and „sales unit update“ workflow rule for opportunity instead of sales order).