I would like to be able to access the comments on the workflow transition to include in an email notification via scripting. Is this data accessible via scripting?
Solved! Go to Solution.
Solved by erictorp. Go to Solution.
Hello,
item.workflowActions[i].comments should allow access to comments placed on a workflow action.
Thanks Eric, so does 'i' represent the workflow action step that you want the comment from?
I’m trying to access the workflow comments in a script that fires on the transition to send an email. I want to put these comments into the email. I have the code to access the comments item.workflowActions[i].comments (thanks Eric) and can get the comments, however it appears that the script fires before the comments are “saved” to this location. If I hard code in the action step I can use the comments from the previous transition but if I try to send comments from the current transition I get a blank/null result. Any ideas?
Has been working fine for me for a little over a year. I have a process that emails out the last transitions comment. Has worked every time for me.
Can you share your script?
I am attempting to do the same thing. I can only access the comments if i hard code the transition step. Can you share your script?
Not sure if this is what you're looking for, but array element 0 (zero) is that last transition. It's always zero which is pretty helpful. So you'd want to check if the comment is populated and if that's true then do some cool stuff. 🙂
if (item.workflowActions[0].comments) { // Do cool stuff }
If comments is populated then it results in true and does cool stuff.
If you need to get a specific comment from a specific workflow transition, it's possible but takes a few more lines of code to step through the workflowActions and test the comment against a string value or with a regex expression. Totally doable though.