Extracting BodyFormData from Before Provisioning Rule

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?

Hi @sita_ram , can you share the exact error or the snapshot of the error you are getting.

@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

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");

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.