Debugging Scripts via Logging

Debugging Scripts via Logging

cedgingtonNJCK2
Participant Participant
117 Views
2 Replies
Message 1 of 3

Debugging Scripts via Logging

cedgingtonNJCK2
Participant
Participant

I'm working on a project that requires quite a bit of custom action script changes. I want to be able to add some logging (via print) to scripts such as "Projects WF Actions", then do a variety of things in the workspace and then view the logging for the different runs of the script. Is this possible at all - or is my only option to go into Test / Debug mode? If that is the only option, how do I discover what all the values should be in the debug panel in order to match exactly what is happening during runtime?

0 Likes
Accepted solutions (1)
118 Views
2 Replies
Replies (2)
Message 2 of 3

cedgingtonNJCK2
Participant
Participant
Accepted solution

FWIW - if anyone is trying to figure out how to do this, the only solution I came up with is to build an array of logging strings and then at the end of scripts call a method that sends myself an email with the body set to that array of strings. This allows me to get essentially "live" logging debugging from scripts executed while moving around in FM. I can do a bunch of things that cause scripts to run - then go look at my emails for the logs - for example, from my "Projects WF Actions" script:

PWFA 1: customTransID: JUMP_TOTOLLGATE_4 dmsID: 16860 userID: gd5yL delegatedUserID: null transID: 1172
PWFA 2: newStep 12 workspaceID 86
PWFA 3: item P0598 - CEdgington Test 04 currentPhase: Tollgate3
PWFA 4: default case + JUMP_TOTOLLGATE_ index: 4 - doing work
PWFA 5: phase states (1 2 3 4): In Work In Work In Work PlannedAll lines added.

 

0 Likes
Message 3 of 3

ForrestJudd
Advocate
Advocate

I'm not sure if you came across this and it doesn't fit your need, but there *is* a way for a script to write to the change log of the record it's running against. The syntax is

 

Logger.log(message)

 

So for this line of code:

 

Logger.log("User ID " + userID);

 

The result comes out looking like this:

 

ForrestJudd_0-1757370367536.png

 

This doesn't appear to be documented anywhere and I'm not sure why unless it's not really intended to be used. It's great for debugging in certain situations, though. 

0 Likes