Format the Email body text into JSON string
- New
- How-to
-
Balasubramanian Natarajan
- PowerBuilder
- Tuesday, 15 April 2025 11:28 AM UTC
Hi All,
We are creating an email configuration window in our PB application.
- In the email window, we are using RichText window control for composing the email body
- Below is the code to copy the email body content to string
ll_numchars = rte_1.SelectTextAll()
ls_richtext = rte_1.SelectedText ( )
ls_EmailBody = Mid( ls_richtext, ll_pos, ll_numchars - ll_pos )
JSON string formation
ls_JSONRequest = '{'
ls_JSONRequest += '"toRecipients": "'+ls_Recipient+'", "ccRecipients": "'+ls_Cc_Recipient+'", '
ls_JSONRequest += '"bccRecipients": "'+ls_Bcc_Recipient+'", "subject": "'+ls_Subject+'", "mailBody": "'+ls_EmailBody+'", "mailBodyType": "text", "attachment": "'+ls_attachment
ls_JSONRequest += '", "attachmentContentType": "application/pdf", "attachmentName": "'+ls_attachment_name+'"}'
3. After JSON string formation we are validating the JSON string in the below code but every time we are getting " Invalid encoding in string " error
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.