Get record from incident that triggered the workflow

Ashim Thapa
Tera Contributor

Hi,

I am new to ServiceNow. I have created a workflow that triggers on whenever priority changes to 1 of the incident. Then it runs a script. The code in the script is failing to get the current record that triggered the workflow. This is my script for testing :

workflow.info("start");
workflow.info(current.variables.sys_created_by);
var created=current.sys_created_by;
gs.info(created);
workflow.info(created);
workflow.info(current.assignment_group);

//current.getValue(fieldName);

var location=current.Location;
workflow.info(location);

No issues with triggering the workflow but I am not finding any current value in workflow log. Please help me on how to use the current, to get the record that triggered this workflow.

 

Thanks.

8 REPLIES 8

Nevermind, I made a silly mistake, now I can see the values in workflow log.

 

Thanks

Ashim

@Ashim Thapa 

Glad to help.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ashim Thapa 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ashim Thapa
Tera Contributor

@Ankur Bawiskar : How can I get the attribute in workflow script. Below is an example:

  • <location display_values="test">fh4567df2389454082efjsjfkjer</location>

current.location gives the "fh4567df2389454082efjsjfkjer".

How can we get value "test" ?

Regards

Ashim