cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to trigger Workflow in SAP Commerce when A Product is received from S/4

ketkimujumdar
Discoverer
0 Likes
347

Hi Everyone! We are working on integrating SAP Commerce cloud with S/4Hana. We have managed to get products from S/4 into SAP commerce catalog. Our aim is to trigger a workflow whenever a new product is imported into SAP Commerce from S/4Hana so that product manager is notified about new product and take the required action. We have managed to create a workflow with desired actions but are struggling with workflow trigger. We are aware of triggering a workflow with workflowProcessingService but We are unable to figure out how to determine a new product is imported from S/4Hana. Any leads on this will be helpful.

Accepted Solutions (0)

Answers (2)

Answers (2)

samuelyang
Product and Topic Expert
Product and Topic Expert

Hi @ketkimujumdar 

Congratulations on successfully integrating SAP Commerce cloud with S/4Hana👍

So apart from @KunalBansal 's solution, you may also try out the OOTB Workflow Activation Script feature.

Regarding the workflow trigger, you can check out the activation script defined on your workflow template. It can be configured OOTB in the Backoffice or ImpEx so that each time a new product is imported/created from S4 into a specific product catalog, a new workflow instance will be automatically created out of the template to notify the product managers.

The Workflow Activation Script is basically a piece of Beanshell script attached to each workflow template, where you can check the current action/event like create, save or remove, and the attributes of the current product item like "approvalStatus" or "catalogVersion", etc. You can write whatever logic or conditions are required to trigger your workflow instances. 

Hope that help 🙂

 

KunalBansal
SAP Champion
SAP Champion

Hello @ketkimujumdar,
May I suggest as below which might help - 
- add a custom attribute (isNewFromS4Hana) to ProductModel and set true when new product got imported.
- implement an Interceptor (using ModelSaveInterceptor or PrepareInterceptor) to check if a product creatyed newly.
- or using ImpEx for product imports, utilize afterImportHook to detect new records and trigger a workflow.
If it helped, mark thread as accepted solution.
Thanks & Regards,
Kunal Bansal, SAP CX SME
https://www.linkedin.com/in/thekunalbansal