sita_ram
(Sita Ram K)
September 30, 2024, 3:10pm
1
I’m trying to write a before provisioning rule that reads the bodyFormData
from the request body. However, I’m having trouble extracting it and getting a parse error when using the following code:
Map body = requestEndPoint.getBody();
Map<String, String> bodyFormData = (Map<String, String>) body.get("bodyFormData");
Can someone please help me understand the correct way to extract the bodyFormData
and use it in my script?
rkhade
(Rakesh Khade)
September 30, 2024, 4:10pm
2
Hi @sita_ram , can you share the exact error or the snapshot of the error you are getting.
rkhade
(Rakesh Khade)
September 30, 2024, 4:51pm
3
@sita_ram , can you try below code snippet
import connector.common.JsonUtil;
import java.util.Map;
Map body = requestEndPoint.getBody();
String formDataString = body.get("bodyFormData");
Map formDataMap = JsonUtil.toMap(formDataString);
Hope this helps
Thank you
2 Likes
sita_ram
(Sita Ram K)
September 30, 2024, 5:16pm
4
Thanks Rakesh for your comment.
I was able to resolve it by updating the script like this:
Map body = requestEndPoint.getBody();
Object bodyFormData = body.get("bodyFormData");
system
(system)
Closed
November 29, 2024, 5:17pm
5
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.