How to get Form's field values in ServiceNow Workflow Run Script
02:11 02 Jul 2020

I am new to ServiceNow. I have created a Catalog Item along with a simple workflow to approve the request and then call a script that will fetch the form's field values and further call a REST API. My form has 4 fields with there variable names as follow - name, operating_system, instance_type, storage I am not able to fetch the values for these fields in the script. Here is my code snippet which I am trying to get the value -

var vm = g_form.getValue('name');

and second way -

var vm = current.name;

Both of these ways are not working. In second way I am getting undefined and in the first way script is not getting processed further without giving an error. Please help. Thanks in advance.

javascript workflow servicenow servicenow-rest-api