cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Field Service Management - Ignore null values, when sending API request with Webhook BR action

samot
Participant
0 Likes
509

Hi guys,

is it possible to set the 'ignore null values', when sending the API request through the Webhook action in the BR?

Our use case:

We are sending API requests to 3rd party API and it's working fine if we fill all the API attributes with some values.

However if we do not include one of the attributes in the API call, the 3rd party API on the other side receives 'null' value for this attribute, so the stored value is 'nulled'.

1. Here is an example with all the attributes filled:

2. Here is an example with the attribute "status" missing:

Is there any way to avoid this behavior?

Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

svengebert
Advisor
Advisor
0 Likes

Hi Tomas

If I understand your question correct the following might be helping.

In the body of Webhook you can use some level of javascript.

{

${serviceCall.remarks ? '"remarks": "' + serviceCall.remarks + '", ' : null }

"code": "${serviceCall.code}"

}

This expression is checking if serviceCall.remarks is empty. If it is empty it will print nothing for remarks in the field. If it has some value it will print the remarks and it's key in it.

-> If remarks has NO value it will print: { "code": "359" }

-> If remarks has value it will print: { "remarks": "This has some value", "code": "359" }

Hope this solves your issue.

Best

Sven