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:
-
Formatted JSON Data
{
"operation"
:
[
{
"INPUT_DATA"
:
[
{
"StageOne"
:
[
]
}
]
,
"OPERATIONNAME"
:
"ADD_APPROVAL_STAGE"
,
"send_immediately"
:
"True"
}
]
,
"message"
:
"Approver added"
,
"result"
:
"success"
}
Here is the script itself:
- param (
- $json = "none"
-
- )
- $jsondata = Get-Content $json -Encoding UTF8 #Encode if necessary
- $appdata = @"
- {
- "operation":[
- {
- "INPUT_DATA":[
- {
- "StageOne":[
- "someone@somewhere.com"
- ]
- }
- ],
- "OPERATIONNAME":"ADD_APPROVAL_STAGE",
- "send_immediately":"True"
- }
- ],
- "message":"Approver added",
- "result":"success"
- }
- "@
- 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?