This workaround utilizes the script parameters on Workflo`w Action scripts to be called during workflow calls. This can be used for debugging workflows by checking what the value of an existing field is since the workflow logs do not show untouched fields.
A. Create the script record:
1. Use the code snippet below:
var logExec = nlapiGetContext().getSetting('SCRIPT', 'custscript_log_execution');
2. Create the script.
a. Navigate to Customization > Scripting > Scripts > New
b. Select Workflow Action and set the following:
Set Name to "Log Execution Script"
Set ID to "_log_execution_script"
Upload the script via the Script File field
Set the function name "wfmLogger"
c. Click the Parameters tab
d. Add a new parameter with the following values:
- Set label to "Log Execution"
- Set ID to "_log_execution"
- Set Type to Free-Form Text
- Click Add
e. Click Save
f. Deploy it to a record (In this example, to the Account record)
e. Add an audience to the deployment (ie, All roles)
B. Create the workflow instance:
1. Navigate to Customization > Workflow > Workflows > New
Name = Parameter for Log Execution
Record Type = Account
Release Type = Testing
On Create = TRUE
On Update = TRUE
Trigger Type = After Record Submit
2. Create State 1
Name = Entry
Do Not Exit Workflow = FALSE
a. Create New Action
Choose "Log Execution Script (Custom)"
On the "Log Execution" field, specify a Text = "This is a sample log."
C. Test the workflow
1. Create an Account record by going to List > Accounting > Accounts > New
2. Fill-out the required fields and Save
3. View the Workflow History tab logs. Below are example logs:
24-MAR-2011 14:46:46.544 Initiated workflow
24-MAR-2011 14:46:46.547 Running ONENTRY trigger
24-MAR-2011 14:46:46.554 Param Power Script
24-MAR-2011 14:46:46.557 CUSTOMACTION: custscript_log_execution=This is a sample log.
24-MAR-2011 14:46:46.608 Running AFTERSUBMIT trigger
- you can apply this to any record available
- you can use the value field to return values of other related fields to check their value the time the workflow is triggered