Hello,
We are passing data from a SC form into PAM by using Event-rule-action to trigger a SRF containing the $form_sd_data_row$ parameter .
In PAM we are recieving the passed data from the parameter as an object containing an array, as follows:
{"10197" : [{"name" : "txtf_1",
"value" : "SomeActiveDirectoryGroupName",
"type" : "5"},{"name" : "txt_2",
"value" : "TheUserId",
"type" : "5"}]}
How can we assign "SomeActiveDirectoryGroupName" and "TheUserId" to a process.variable when the name of the object/the number, 10197, is changing every time the user submits this request.
We have tried several methods that work in regular Javascript and common libraries.
1. Looping through the Array:
// since the nameof first property will vary, always get it by looping the json
var firstItem;
for (var prop in json) {
if (json.hasOwnProperty(prop)) {
firstItem = json[prop];
break;
}
}
var groupFromForm = firstItem[1].value;
It seems that hasOwnProperty is not accepted.
I'm not sure that looping through the Array works at all.
2. Using object.key
var myText = {"10132" : [{"name" : "txtf_1",
"value" : "SomeActiveDirectoryGroupName",
"type" : "5"},{"name" : "txt_2",
"value" : "TheUserId",
"type" : "5"}]}
var myKey = (Object.keys(myText));
Object.keys is not accepted.
We have been able to make this work by using a regex expression that assigns the Array to a variable, and then refering to the variable[index].value. However, this is not very robust, as the form needs to remain unchanged for this to work, becuase the the content of the array must always be sent in the same exact order.
Any help is appreciated!!
Thank you!
--
Sondre