Powershell Script issue

Powershell Script issue

Alright, I give up.  I've been working on it a couple days now and I still can't get it working.  Hopefully someone can tell me what I'm doing wrong.

Let me start by saying I am not at all interested in setting up Python on my server.  I'm sure it's wonderful, but I've already got my hands full and I can't afford to put Python on my to do list.

So, I'm trying to set up adding an approval and sending the mail via Powershell script as a Custom Trigger.  My SD install in on prem, and version 10.5 (build 10506).

There's good news here.  The custom trigger itself is working.  It looks like this:


I know that the powershell script does in fact run, because I added some code to send myself an email with the ticket number as a test, and while that code is in the script, I get an email with the ticket number.  I can also look at any of the requests which meet the trigger criteria and I see this in the history:


This is where the good news ends.  The things I ask it to do are not working.  For the purposes of just making it work, I've dummied up some JSON that I believe has all the correct sections.  It looks like this:

  1. Formatted JSON Data
    {  
        "operation" : [  
            {  
                "INPUT_DATA" : [  
                    {  
                        "StageOne" : [  
                            "somebody@somewhere.com"
                        ]
                    }
                ] ,
                "OPERATIONNAME" : "ADD_APPROVAL_STAGE" ,
                "send_immediately" : "True"
            }
        ] ,
        "message" : "Approver added" ,
        "result" : "success"
    }
Here is the script itself:

  1. param (
  2.     $json = "none"
  3.     
  4.  )

  5. $jsondata = Get-Content $json -Encoding UTF8   #Encode if necessary


  6. $appdata = @"
  7. {  
  8.    "operation":[  
  9.       {  
  10.          "INPUT_DATA":[  
  11.             {  
  12.                "StageOne":[  
  13.                   "someone@somewhere.com"
  14.                ]
  15.             }
  16.          ],
  17.          "OPERATIONNAME":"ADD_APPROVAL_STAGE",
  18.          "send_immediately":"True"
  19.       }
  20.    ],
  21.    "message":"Approver added",
  22.    "result":"success"
  23. }
  24. "@


  25. return $appdata
Yes, I do refresh the ticket before I assume no approvals have been added.  Likewise, I make sure that the approvers email is valid and that they are not receiving anything.

The incoming JSON data is good, as I have used it while testing to get the ticket number emailed to myself.

What on earth am I missing here?



                  New to ADSelfService Plus?