Help with an API Call to SAP GRC requiring custom variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:32 AM
I am creating an outbound SOAP message from ServiceNow to SAP GRC.
I have successfully created a SOAP Message, and the script works when I enter values for the variables, and pass the information using the Test button on the specific method for the API call.
I then created a UI Action on the table that will feed the values from the record to the API call and pass it to SAP GRC.
The majority of the process is working--it connects, passes (most of) the data, and returns the desired response.
The problem is that one part of the ask is to pass the current record number as a custom variable in GRC. This variable is passed to a different table, and the XML of the code should take the format:
<CustomFieldsVal>
<!--Zero or more repetitions:-->
<item>
<Fieldname>${item.Fieldname}</Fieldname>
<Value>${item.Value}</Value>
</item>
</CustomFieldsVal>
In the method for the SOAP API, this results in variables item.Fieldname and item.Value. When I put the desired data in those variables (item.Fieldname is SNOW.REQ, and item.Value is a record number such as TIC001234) the information passes correctly to GRC, and GRC has access to the record number.
In my UI action, however, when I try and pass this information the way I do the other data, it doesn't work:
So, for example, the following works (as it's a variable defined as part of the <RequestedLineItem><item> section of the body):
sm.setStringParameter('item.Email', current.u_business_caller.email); // Set the email to the Business Caller's email
When I try the following for the custom field section, the call works, but the ticket number information is not included in the request sent over (note: this is how they appear in the variables list in the method):
sm.setStringParameter('item.FieldName','SNOW_REQ');
sm.setStringParameter('item.Value',current.number);
Any idea what I'm doing wrong? I'm sure I'm just declaring the variables incorrectly, but I'm unsure how to fix it.