The CreatorCon Call for Content is officially open! Get started here.

Print to Execution Details Log

snowblind
Tera Expert

Ref: Solved: Can I write logs to the Execution Details record - ServiceNow Community

The reference question isn't solved as the link it points to no longer works.

I'm creating a custom action with a javascript script.  I need the ability to print output to the Logs section of the Execution Details from javascript.  How can I do that?

This shows how to view the log, but not how to print to it in the first place:

Flow execution details (servicenow.com)

4 REPLIES 4

harshav
Tera Guru

You can add to the status field of every step which will be logged there. you can access it using "outputs.status" and set the value whatever you need

If I understand correctly, that doesn't work.  In my script, I did this:

outputs.status = "123";
Then I added an Error Evaluation condition:
error_condition.png

I get this repeated in Output and Step Output data:

{
"Action Status": {
"code": 0,
"message": "Success"
}
}
 

If I understood correctly, that doesn't work.

I did this in my script:

outputs.status = "123";

I added an Error Evaluation, yet both Output Data and Step Output data show:

{
"Step Status": {
"code": 0,
"message": "Success"
}
}

If I understood correctly, that doesn't work.

I did this in my script:

outputs.status = "123";

I added an Error Evaluation, yet both Output Data and Step Output data show:

{
"Step Status": {
"code": 0,
"message": "Success"
}
}