- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2021 02:30 PM
I created an Action in flow designer that sends a Rest request to my server. I used the Rest integration to create this action. When I try to pass json that was created from a previous Action and then I test the workflow I get the following error "class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')". If I test the Rest Action independently and pass the same exact json payload it works fine. Maybe Im not passing the variable in correctly or my previous Action that builds the json has something wrong with it. Please see my included screen shots below.
Picture of Rest Action inputs
Picture of Rest Action step
Pictures of the Action that builds the json
Pictures of the Error that occurs during Rest Action when the workflow is tested
Pictures of when the Rest Action is tested independently and is passed the same exact json it works.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
-
Studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2021 09:33 PM
Hi
in your REST step, you have dragged the JSON-based payload into the request body field and this cannot work. FlowDesigner needs a String there and does not know what part of your JSON object should be inserted.
If you want to send the complete JSON payload in a serialized form you have to call JSON.stringify() anywhere. For example you could build another action which does that job.
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2021 09:33 PM
Hi
in your REST step, you have dragged the JSON-based payload into the request body field and this cannot work. FlowDesigner needs a String there and does not know what part of your JSON object should be inserted.
If you want to send the complete JSON payload in a serialized form you have to call JSON.stringify() anywhere. For example you could build another action which does that job.
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2021 01:15 PM
Thanks Maik. Let me test it out. So you saying just call JSON.stringify on the entire payload before passing it to the Rest Step/action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2021 01:45 PM
That worked. Thank you! Its just odd because on the input of the action if you make it a String you would think it would convert it to a String or throw an error if the value you something other than a String but it doesn't...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2021 06:41 PM
Hi
Did my reply answer your question?
If so, please mark the appropriate response as "correct" so that the question will appear as resolved for other users who may have a similar question in the future.
If not, please tell me what you are still missing!
Many thanks & kind regards
Maik