Postfunctions failed to load on workflows on new instances

Hi,

Anyone can confirm (or) let me know the issue with AP.jira.WorkflowConfiguration API which we observed recently in our app. When installing the app in new cloud instances we are getting issues like the below in the browser console, while viewing the post functions.

all.js:16 [Simple-XDM] Unexpected token u in JSON at position 0 SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse () at https://csot-stage.dts-bobswift.appfire.app/ui/updateissue-view.fa39ddf3dcdbe5384207.js:78:123030 at b.d._handleResponse (https://connect-cdn.atl-paas.net/all.js:63:99) at b._receiveMessage (https://connect-cdn.atl-paas.net/all.js:21:77)

The issue arises because this API(AP.jira.WorkflowConfiguration) was not calling on async componentDidMount() and at execution time onSave function was skipped to save the config object. Due to this while loading post functions in the workflow, we are getting the below error

"all.js:16 [Simple-XDM] Unexpected token u in JSON at position 0 SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse ()"

async componentDidMount() {
await postEvent();
AP.jira.WorkflowConfiguration.onSave(function() {
const { config } = _that.state;
return JSON.stringify(config);
});

}

Hi @DharmaTeja ,

I understand that our JavaScript attaches a WorkflowConfiguration object to AP.jira, however, I don’t think it’s part of the API. The WorkflowConfiguration.onSave() is not intended to be called from apps.

Regards,
Dugald

1 Like

@dmorrow please see the API documentation for apps:
https://developer.atlassian.com/cloud/jira/software/modules/workflow-post-function/

2 Likes

Thanks @StefanForstmoser , I’ve raised an issue on the documentation to include details about the WorkflowConfiguration object in https://developer.atlassian.com/cloud/jira/software/jsapi/jira/ because I missed it.

Would mind explaining the problem you’re having as I’m having difficulty interpreting it.

1 Like