How can I get the output from a custom powershell activity to show in another activity further in the workflow

User163016
Tera Contributor

Within the custom PS activity, I set up the variable to output: Write-Host "$($DPW)".   The next activity is a notification where I need to take the output (dpw) and send in an email.   I've tried several things within the notification with no success:

${activityOutput.result}

${activityOutput.dpw}

${dpw}

Every way I try it, I always get blank output.

I put logging into place so that I know I'm getting the correct output, I just can't get it to show up in the next activity.

Thanks in advance for your assistance

5 REPLIES 5

Gurpreet07
Mega Sage

Hi Chad,



Store the output of custom powershell activity into scratchpad variable and use that scratchpad variable in next activity.


Using the Workflow Scratchpad - ServiceNow Wiki


Workflow scratchpad variables


Hi Gurpreet,



I've looked through the documentation and I'm not finding any hard and fast rule that gives me what I need, so I'm kind of winging it.   What I've done is add:


workflow.scratchpad.dpw = activityOutput.dpw;


to the post processing script, but now when it runs, I get an error: "Cannot set property "dpw" of undefined to [output value].



Any ideas?



Thanks,


Check this out:

 

https://community.servicenow.com/community?id=community_question&sys_id=69440f29dbd8dbc01dcaf3231f9619cd

Kai Tingey
Tera Guru

Hi Chad

Did you ever work this out?

I'm tearing my hair out trying to do the same thing.