Workflow


Setting Up For Servicenow

Adding a Custom Field.

  • Create a custom field on the object you are connecting to Field Nation. We recommend creating a checkbox and labeling it something like “Send to FN”.

  • You can then go into the formatting of the object you are using and add it to the form.

Creating the Workflow Rule

  • Go into the workflow editor and create a new workflow on the table you want to utilize.
  • Set the conditions as “Send to FN” (or whatever you called the custom trigger field) is True.

  • find the core tab on the right hand side of the editor.

  • drag the Run Script to the page.

  • Give the script a name

  • In the Script section: Use the following script.

try {
    var restMessage = new sn_ws.RESTMessageV2();
    restMessage.setHttpMethod("post");
    var fnUrl =  "{{trigger URL}}&external_id=" + current.sys_id;
    var endPoint = fnUrl;
    restMessage.setEndpoint(endPoint);
    restMessage.setRequestBody("{\"id\" : \"" + current.sys_id + "\"}");
    var response = restMessage.execute();
} catch (e) {}

For the fnURL, please put the Trigger URL from the Field Nation settings page.

  • Connect the Begin Step to the Run Script Step and the Run Script Step to the End Step.
  • Lastly, validate and publish your workflow.