I have a complex json object with which a camunda process starts(via postman). I need to validate the fields in this json object using javascript (script task). I couldn’t find any clue of how to start with. Any help regarding this please.
you can configure it similarly groovy script the javascript in script task to validate the JSON using SPIN feature.
Script Format: javascript ScriptType: Inline script(you can provide the code in Script area while modeling) or External Resource(you can refer from classpath) ResultVariable: you can store the result of validation in a variable.
Example SPIN api use in Script Task:
var carJson = execution.getVariableTyped("car").getValueSerialized();
var price = S(carJson ).prop("price").numberValue();
execution.setVariable("price", price);