RE: How would I make a WorkflowActionScript that can send a POST message?
Hi there everyone, first time posting and first time working with Netsuite.
I’ve been trying to figure out how to build some WorkflowActionScript where on this step in the workflow, it would send the “ScriptContext” to another application.
I’ve got a script deployed like that looks like this…
/** * @NApiVersion 2.0 * @NScriptType WorkflowActionScript * @NModuleScope public **/ define(["N/https", "N/log"], function (https, log) { function onAction(scriptContext) { log.debug(scriptContext); return https.post({ url: "https://myapp.com/netsuite", body: JSON.stringify(scriptContext), }); } return { onAction: onAction, }; });
But it doesn’t seem to be working. Using Postman, I can POST a message to my endpoint and receive it. It seems like when the source is Netsuite, it won’t work and I’m not sure what I’ve done that isn’t working.
Looks like I found an alternative way to get data back out of Netsuite via a saved search RESTlet.
With my own integration, I can set up a polling server to get the results of the saved search and act on that.