Any documentation on the JavaScript SDK for how to use it in a separate Web app? The SDK-JS samples don't seem to work

Hi.

Is there a reference on how to use the vast functionality in the JS SDK?

I’m trying to embed Tasklist and Process forms into a portal Web app and the SDK samples (https://github.com/camunda/camunda-bpm-examples/tree/master/sdk-js) basically demonstrate viewing and processing Tasks to start but they don’t work.

Also the SDK-JS project https://github.com/camunda/camunda-bpm-webapp/tree/7.13/camunda-bpm-sdk-js points to the Embedded Forms Reference https://docs.camunda.org/manual/7.5/reference/embedded-forms/ which doesn’t cover how to use the Form SDK from a separate Web app, not just use a customer Web app WAR in the Camunda Web app.

When I try the browser-forms sample, Chrome complains with: scripts.js:100 Uncaught TypeError: Cannot read property 'replace' of null

taskService.form(taskId, function(err, taskFormInfo) { 
   var url = taskFormInfo.key.replace('embedded:app:', taskFormInfo.contextPath + '/');
   // taskFormInfo is returned as null, yet I can retrieve the task list ID up to this point
   ...
}

The task IDs are correct in the sample, so maybe something has changed in the API? The sample was updated recently but it’s not working as expected. I deployed it to my Camunda webapp directory and simply browsed to it.

Any advice is greatly appreciated.

Hi,

thank you for the hint with the outdated link. I fixed it on master, here is the latest link :slight_smile:

As for the issues you are facing:
How does your process look like in the modeler? It seems like the Form Key is empty.
The example makes use of embedded forms. It will not work with generic or external forms.

I just tried it on a 7.13.0 tomcat with the invoice example and it seems to work as intended.

Thanks for replying Martin! Yes, I’m using an external form hosting with Camunda in a separate webapp WAR. Do you know how or where an external task form URL is accessed and will it work with the SDK-JS? I was going to try to determine the external form URL and fix it in the sample to test. Any tips are greatly appreciated. Thanks!