How to trigger workflow process when form data is submitted via API

Angel P - 15 Oct, 2025

Hi everyone,

I have a case where form data is being received to my Joget app through an external API. The data is successfully saved into the form, but I want each record that comes in through the API to automatically start the workflow process (for example, to trigger the approval process). What I know is that a process instance normally starts when a user manually submits the form via the app. Since this data is inserted via API, the workflow process doesn’t start automatically. Is there a way to trigger or start the workflow process right after form data is created through the API?

activity;api;process

1


wak joko •
24 Oct, 2025 •
wakjoko •
0 •
angeliicp •

Hi Angel,

 

Joget allows to start any workflow process using its ID, programmatically:

https://kb.joget.org/jw/web/userview/jdocs/docs/DX9/workflowmanager#WorkflowManager-processStart

https://kb.joget.org/jw/web/userview/jdocs/docs/DX9/apputil#AppUtil-getProcessDefIdWithVersion

 

You might want to modify below Beanshell code example and use it in any Element that can execute Beanshell to observe if its working.

HttpServletRequest request = WorkflowUtil.getHttpServletRequest();

// Optional: pass on request payload to the process workflow variable
Map workflowVariables = new HashMap();
workflowVariables.put("payload", IOUtils.toString(request.getReader()));

// Get the process
AppDefinition appDef = (AppDefinition) AppUtil.getCurrentAppDefinition();
PackageDefinition packageDef = appDef.getPackageDefinition();
WorkflowManager workflowManager = (WorkflowManager) AppUtil.getApplicationContext().getBean("workflowManager");
String processDefId = AppUtil.getProcessDefIdWithVersion(packageDef.getId(), packageDef.getVersion().toString(), "MyProcessId");

// Kickstart the process
WorkflowProcessResult started = workflowManager.processStart(processDefId, workflowVariables);

 

 

Hope this helps!

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print