How to make IF conditions in JSON request body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 10:19 AM
Hi,
I want to check for condition in JSON while sending the request in Integration. How can I use IF statement condition or something similar for validating the conditions in JSON request.
For example ::
If(x = 'a')
{
"components": [{
"id": "78901"
}]
}
else
{
"components": [{
"id": "123456"
}]
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 10:21 AM
Hi,
You should create json request based on IF condition rather than trying to add If condition within json request.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 10:22 AM
Harish,
I believe you are trying to set value of ID in Json before passing the value to other application. You need to write your If condition in the business rule or the script include from where you are calling the web service.
~Raghu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 10:43 AM
Thank you for the response, could you please help me how can I do that with your sample code of explanation.
I have written the business rule, it is not an issue.
Now what I need is, I have 2 conditions.
it should do something like this below
If(true)
{
payload 1
}
else
{
payload 2
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 10:47 AM
can you share your business rule code?