Passing properties from a flow designer step to a form

Not Yet Reviewed

We have a flow that finds all open events sharing a common "group" property, and then terminates them all. For each event terminated, we need to send an SMS message containing certain properties to a machine outside of xMatters. 

Right now, the messages are being sent, but we are having trouble passing the necessary properties along so that they appear on the form.

For this purpose we are using a shared library containing the code below. When the form is triggered, the resulting event doesn't contain any properties besides recipient and initiator. 

exports.ackSSGNagios = function( propertiesString ) {
var request = null;
var request_4SSG_Nagios = http.request({
'endpoint': 'xMatters',
'method': 'POST',
'path': '/reapi/2015-04-01/forms/5f992a7a-7fe6-45b4-b05b-cf2ac137ed2f/triggers',
'headers': {
'Content-Type': 'application/json'
}
});

var properties = JSON.parse(propertiesString);

console.log("IN ackSSGNagios METHOD!");
console.log("RECEIVED_PROPS == " + propertiesString);

// Check for proper GROUP and SEVERITY:
if (properties['group#en'] == "ssg-hosting" || properties['group#en'] == "ssg-network" || properties['group#en'] == "ssg-os-linux" || properties['group#en'] == "ssg-os-windows" ||
properties['group#en'] == "database" || properties['group#en'] == "mysql-database" || properties['group#en'] == "sqlserver-database" || properties['group#en'] == "webinfra-pager") {
request = request_4SSG_Nagios;

console.log("AFTER GROUP FILTER!");
if (properties['severity#en'].toUpperCase() != "NORMAL") {
//var json = {};
//json.ticket = {};
var data = {};
data.properties = {};

console.log("EVENT_PROPERTIES == " + JSON.stringify(properties));
//json.ticket.properties = properties;
data.properties = properties;

var response = null;

console.log("READY TO PAGE!");
//response = request.write(json.ticket);
response = request.write(data);
// Write the response to the activity stream
if (response !== null) {
console.log("RESPONSE_DATA: " + JSON.stringify(response));
}
}
}
};

0

Comments

1 comment
Date Votes

Please sign in to leave a comment.

  • Hey Michael!

       I'm guessing the output of this line:

    console.log("EVENT_PROPERTIES == " + JSON.stringify(properties));

    is as expected?

    If not, make sure all your properties have "Include in outbound integrations" on the originating form. That ensures the properties are available in the outbound integration. 

    If the output of that line is ok, then that means the properties are being created properly, and your syntax for creating the event looks ok. 

    The only other thing I can think of is to make sure the form has properties of the same name. I'm wondering if you'll need to strip the "#en" from the names? The console output might show they have the #en, in which case they will be ignored, unless you have a property with a #en at the end. 

    I'm guessing you have a lot invested in these IB scripts, but you might consider moving them to the Flow Designer. And if you're missing some feature that would prevent such a move, let's chat. 

    Let me know how that works out!

    Happy Wednesday!
        --- Travis

    0

Didn't find what you were looking for?

New post