I think I have found a bug in the `Create Event` flow step that I wanted to point out. If I am wrong, maybe someone can help me to get my script working.
I want to first preface this to say that everything I am detailing working 100% if I use the old, deprecated, INBOUND INTEGRATION system. I am only trying to get this working because I want to get away from deprecated stuff.
Here is the flow
1) Form is submitted in WebUI and triggers flow.
2) Flow ends with an xM Agent call, passing the properties of the event to a script now being executed on my server
3) Script runs it's magic and then generates a payload and then attaches the payload to a POST request to an HTTP Trigger in xMatters Cloud.
4) From here, it should accept the parameters it was given and initiate an event, populating it's property fields with the content from the payload. It does not, it fails.
As best as I see it, here is the issue. The one offending piece here is that one of the properties is a LIST field. As such, it is expecting an array of string objects (which must match with it's predefined values in the property of course, can't just put anything in there).
Well, everything works if only 1 (one) item is being included in the payload. Nice! If there is more than one, it breaks. Dang!
For the property in the flow step (when you double click from the canvas) it has an "i" next to it explaining to include a list of values, separated by commas for new values.
I think it is expecting that I literally click, drag and drop PROPERTY 1 then do a COMMA, followed by click, drag and drop PROPERTY 2 in this field and so on. Obviously, we can't do this because what could be selected is variable depending on what the user selects in the initial form. It could be any combination of over 50 items from this property.
Thinking that maybe it would parse for me, I took the value for this property from the previous step (had 4 items) and I ran some code that compiled it into a single string, separated by commas. This didn't work either because it treated it as one giant item.
I know that the inputs need to be in string format, and that's limiting our options here as LIST properties are obviously OBJECTS and not STRINGS.
I'd love to hear the thoughts of some other users or staff on how to resolve this issue. For the time being, I am going to go back to the deprecated INBOUND INTEGRATION to get this thing working. Below is some code and payload examples to demonstrate the issue.
First, one that works (only 1 item selected)
** I have redacted content that is unique to my company but is irrelevant to the debugging of this issue...
Input Payload to HTTP Trigger
{ "properties": { "Actions": "[REDACTED]", "Distribution": [ "ETX: Core Technology & Initiatives" // <---- only 1 value! ], "Impact": "[REDACTED]", "Next Briefing": "5/26/20 12:00pm", "Problem": "[REDACTED]", "Title": "Multiple Applications Unavailable", "Subscription List": [ "ETX: Core Technology & Initiatives" ] } }
HTTP Trigger Output
distribution: |
"ETX: Core Technology & Initiatives" |
Create Event Input
..."Distribution":["ETX: Core Technology & Initiatives"]...
Now for what I am trying to get working, but is currently broken (Multiple Items in Payload)
HTTP Payload Input
{ "properties": { "Actions": "[REDACTED]", "Distribution": [ "ETX: Core Technology & Initiatives", "ETX: Digital Operations", "MMUS: MMUS Insurance Operations" ], "Impact": "[REDACTED]", "Next Briefing": "5/26/20 12:00pm", "Problem": "[REDACTED]", "Title": "Multiple Applications Unavailable", "Subscription List": [ "ETX: Core Technology & Initiatives", "ETX: Digital Operations", "MMUS: MMUS Insurance Operations" ] } }
HTTP Payload Output
"ETX: Core Technology & Initiatives, ETX: Digital Operations, MMUS: MMUS Insurance Operations"
The above took an array of strings and produced a single string using the following code block
var distribution_txt = '';
for(i = 0; i < payload['Distribution'].length; i++) {
var delimiter = i < payload['Distribution'].length - 1 ? ', ' : '';
distribution_txt += `${payload['Distribution'][i]}${delimiter}`;
}
output.distribution = distribution_txt;
Also tried this (simply passed the value to CREATE EVENT, as it was received in the input payload (a simple array)
"["ETX: Core Technology & Initiatives","ETX: Digital Operations","MMUS: MMUS Insurance Operations"]"
Create Event Input
... "Distribution":["ETX: Core Technology & Initiatives, ETX: Digital Operations, MMUS: MMUS Insurance Operations"] ...
So then, it fails of course. Error message indicates it's not a valid selection, which it isn't in how it's formatting it
Script failed with message: The value (ETX: Core Technology & Initiatives,ETX: Digital Operations,MMUS: MMUS Insurance Operations) of the input property 'Distribution' is not a valid value. Valid values are:
Comments
Please sign in to leave a comment.
Hi Michael,
I brought this to the attention of our integration gurus shortly after you posted. I remember seeing a post very similar to this which I found here:
https://support.xmatters.com/hc/en-us/community/posts/360056020091-Running-into-issues-triggering-forms-from-Flow-Designer
I'm working with you over that service request as well so I'll be in touch. In the meantime let's see what the broader community has to say for ideas and experiences they've gone through. If we come up with a solution I can post it here as well as a follow-up.
Happy Thursday!