Scripting Help- How to create a custom FD Action to parse JSON

Su522
Kilo Sage

How can we create a custom FD Action to parse a JSON message?

We have attempted, but receive an error:

Error: Empty JSON string,Detail: Empty JSON string

 

Details:

Input: JSON Message as a String

Su522_0-1748535482003.png

 

Script Step:

(function execute(inputs, outputs) {

    var jsonString = inputs.jsonString;
    var jsonObj = JSON.parse(jsonString);
    outputs.objid = jsonObj.content[0].objid.toString();
    })(inputs, outputs);
 
Su522_1-1748535660417.png

 

 

When testing we are using this:

{"@odata.count":5,"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#chats('19%3A093d9fcdef654b15b9e91f7973097e59%40thread.v2'...","value":[{"summary":null,"lastModifiedDateTime":"2025-05-23 12:14:08","lastEditedDateTime":null,"attachments":[],"chatId":"19:093d9fcdef654b15b9e91f7973097e59@thread.v2","replyToId":null,"subject":null,"importance":"normal","createdDateTime":"2025-05-23 12:14:08","deletedDateTime":null,"policyViolation":null,"locale":"en-us","body":{"contentType":"html","content":"<p>Test messages from Susan on Teams- Test BBB</p>"},"channelIdentity":null,"messageType":"message","webUrl":null,"mentions":

 

What we need to parse (extract) is the text for only: 

Test messages from Susan on Teams- Test BBB

 

Su522_2-1748535830166.png

 

Can someone please help with this scripting issue?

Help is greatly appreciated!!

Thank you,

Susan

1 REPLY 1

Hristo Ivanov
Kilo Sage

Hey Susan,

 

You can check the following community posts:

 

https://www.servicenow.com/community/developer-forum/script-for-json-parse-action-in-flow-designer/m...

 

https://www.servicenow.com/community/developer-forum/json-parser-step-flow-designer/m-p/1635803

 

Depending on your integration hub licenses there's also this OOTB step that you can add to your action:

https://www.servicenow.com/docs/bundle/xanadu-integrate-applications/page/administer/flow-designer/r...

 

Please mark my answer as correct and helpful if it helped you solve your issue