Cant create custom workflow action function

Hello everyone! Im working on a custom workflow action, and for that purpose I need a post action execution so I can assign the return value to an output field.

However, as you can see on the print screen, when I try to create such function, the creation returns me a blank array.

Any pointers? Thank you.

Hey, @JFigueiredo :waving_hand: Welcome to our community!

Did you get this resolved? If not, can you add the request URL, request, body, and the response + any errors you receive, as code blocks, please? It’s challenging for our community to troubleshoot code from only screenshots.

Thank you! — Jaycee

PS – you didn’t do anything wrong. Screenshots are great in numerous instances. But for code help, being able to copy + paste and try to reproduce the issue, is always best :blush:

Hi there,

I havent solved the issue just yet, but as requested Ill paste in the relevant code blocks:

URL and method: PATCH https://api.hubapi.com/automation/v4/actions/{{appId}}/{{actionId}}?hapikey={{developerKey}} -- For testing a POST to create works too.

Body:

{

“actionUrl”: “https://139735294.hs-sites-eu1.com/_hcms/api/create-project”,

“objectTypes”: [

“DEAL”

],

“published”: true,

“inputFields”: [

{

“typeDefinition”: {

“name”: “dealName”,

“type”: “string”

},

“supportedValueTypes”: [

“OBJECT_PROPERTY”

],

“isRequired”: true

},

{

“typeDefinition”: {

“name”: “dealId”,

“type”: “string”

},

“supportedValueTypes”: [

“OBJECT_PROPERTY”

],

“isRequired”: true

}

],

“labels”: {

“en”: {

“actionName”: “Create Jira Project”,

“actionDescription”: “This action will create a new Jira project”,

“actionCardContent”: “Create Jira Project {{dealName}}”,

“inputFieldLabels”: {

“dealName”: “Deal Name”,

“dealId”: “Deal ID”,

“jiraProjectId”: “Jira Project ID”

},

“inputFieldDescriptions”: {

“dealName”: “Insert the Deal Name field property”,

“dealId”: “Insert the Deal ID field property”,

“jiraProjectId”: “Insert the Jira Project ID field property”

}

}

},

“outputFields”: [

{

“typeDefinition”: {

“name”: “jira_project_id”,

“type”: “string”,

“fieldType”: “text”

}

}

],

“functions”: [

{

“functionType”: “POST_ACTION_EXECUTION”,

“functionSource”: “exports.main = (event, callback) => {\r\n callback({\r\n outputFields: {\r\n jira_project_id: \“example output value\”\r\n }\r\n });\r\n}”

}

]

}

Response:

{

“actionUrl”: “https://139735294.hs-sites-eu1.com/_hcms/api/create-project”,

“published”: true,

“inputFields”: [

{

“typeDefinition”: {

“name”: “dealName”,

“type”: “string”,

“fieldType”: null,

“options”: [],

“optionsUrl”: null,

“referencedObjectType”: null,

“externalOptions”: false,

“externalOptionsReferenceType”: null

},

“supportedValueTypes”: [

“OBJECT_PROPERTY”

],

“isRequired”: true,

“automationFieldType”: null

},

{

“typeDefinition”: {

“name”: “dealId”,

“type”: “string”,

“fieldType”: null,

“options”: [],

“optionsUrl”: null,

“referencedObjectType”: null,

“externalOptions”: false,

“externalOptionsReferenceType”: null

},

“supportedValueTypes”: [

“OBJECT_PROPERTY”

],

“isRequired”: true,

“automationFieldType”: null

}

],

“objectRequestOptions”: null,

“labels”: {

“en”: {

“inputFieldLabels”: {

“dealName”: “Deal Name”,

“dealId”: “Deal ID”

},

“inputFieldDescriptions”: {

“dealName”: “Insert the Deal Name field property”,

“dealId”: “Insert the Deal ID field property”

},

“actionName”: “Create Jira Project”,

“actionDescription”: “This action will create a new Jira project”,

“actionCardContent”: “Create Jira Project {{dealName}}”

}

},

“objectTypes”: [

“0-3”

],

“outputFields”: [

{

“typeDefinition”: {

“name”: “jira_project_id”,

“type”: “string”,

“fieldType”: “text”,

“options”: [],

“optionsUrl”: null,

“referencedObjectType”: null,

“externalOptions”: false,

“externalOptionsReferenceType”: null

}

}

],

“id”: “41458696”,

“revisionId”: “14”,

“functions”: []

}

As you can see I have inserted “functions” on my body request yet the answer comes back as an empty array.