Feature/parse json make email body#54
Feature/parse json make email body#54anurampalli wants to merge 2 commits intoServiceNowDevProgram:mainfrom anurampalli:feature/parse-json-make-email-body
Conversation
…ts by removing a specified number of header lines. The script fetches the target attachment, skips the requested number of lines, and outputs the cleaned CSV content. Optionally, it can write back the cleaned data as a new attachment. Handles missing content and errors gracefully. Inputs(attachmentSysId, linesToSkip,writeBackAsAttachment, parentTable, parentSysId, newFileName) Outputs (cleanedCSV, cleanedAttachmentSysId)
…text or HTML. Use Case: Automatically alert support teams and management of high-priority incidents, including all relevant fields, in a well-formatted email. Step 1 – Script: Recursively parses JSON (jsonString) into text or HTML (tables/lists). Supports nested objects and arrays. Outputs emailBody and status. Step 2 – Email: Sends the formatted email using emailTo and emailSubject. Script step is modular and reusable. Notable Features: outputFormat choice input added. Handles empty/invalid JSON gracefully with descriptive error messages in email body. Testing: Verified both text and HTML outputs. Confirmed emails to multiple recipients. Errors in JSON parsing appear in the email body instead of failing silently.
|
✅ Valid PR for ActionPack Thank you for your contribution. This PR complies with the CONTRIBUTING.md. |
|
Thanks for your submission. |
|
Thank you Rohila.
After my earlier Pull Request was approved, I created another feature
branch and used that to create this PR. Looks like that caused the issue.
Deleted the fork, forked the ActionPack repo again and ... and submitted a
fresh PR with no conflicts. Another PR, another learning :-D
…On Sat, 4 Oct 2025 at 21:50, Rohila V ***@***.***> wrote:
Closed #54 <#54>.
—
Reply to this email directly, view it on GitHub
<#54 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BQUBSOS3W2TADNR5BAY3RQT3V6X7HAVCNFSM6AAAAACII2XXE6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRQGA4TKOBZHE2TINY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Two-Step Flow Designer Action: JSON Parsing and Email Notification
This is a design document for a reusable, two-step Flow Designer Action for parsing a JSON payload and sending its contents in a well-formatted email (Text or HTML).
1. Action Name & Description
2. Step 1: Script - JSON Parser
This step contains the core logic for recursive JSON parsing and formatting.
2.1 Inputs
jsonStringemailSubjectemailTooutputFormatemailBody.2.2 Script Logic (Pseudo-code/Summary)
jsonStringis null or empty. If so, setemailBodyto an error message andstatusto 'Error'.jsonStringusing a built-in JSON parser function (e.g.,JSON.parse()).statusto 'Error'.emailBodyto a descriptive error message: "Error: Invalid JSON structure provided. Details: [Parsing Error Message]".formatJson(data, format)):<table>or ordered/unordered list (<ol>,<ul>).formatJson(parsedData, outputFormat). Set the returned string toemailBody.statusto 'Success'.2.3 Outputs
emailBodystatusemailSubjectemailTo3. Step 2: Email - Send Formatted Email
This step is a standard Email action that consumes the outputs from Step 1.
3.1 Inputs
$Step 1.emailTo$Step 1.emailSubject$Step 1.emailBodyoutputFormatchoice.3.2 Conditional Logic
4. Notable Features & Testing Summary
JSON Parser) is self-contained and reusable in other actions requiring JSON to structured text/HTML conversion.outputFormatChoice: Allows the caller to easily switch between simple text (for plain terminals/low-fidelity) and rich HTML (for better readability/branding).$Step 1.emailBodyand sent in the notification, immediately alerting the recipients to the parsing issue (e.g., a bad integration payload).emailTo.