Scripted Rest message Get menthod not getting HTML field type value

Rushi2
Tera Expert

Hi All, 

 

I am developing a scripted Rest message Get method, to get the KBs.  Here I am not able to get HTML-type fields. 

 

Can someone help me to get HTML in the get method?

 

(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
    var val = [];
    // implement resource here//
    var grchatgpt = new GlideRecord('kb_knowledge');
    grchatgpt.addEncodedQuery("workflow_state=published^kb_knowledge_base=100c36a80f115244272e244be1050e88");
    grchatgpt.orderByDesc('sys_updated_on');
    grchatgpt.query();
    while (grchatgpt.next()) {
        var abc = grchatgpt.kb_introduction.toString();
        var res = {
            "Number": grchatgpt.getValue('number'),
            "knowledge base": grchatgpt.getDisplayValue('kb_knowledge_base'),
            "valid to": grchatgpt.getValue('valid_to'),
            "short description": grchatgpt.getValue('short_description'),
            "Assignment group": grchatgpt.getDisplayValue('u_assignment_group'),
            "Internal notes": grchatgpt.getValue('u_internal_notes'),
            "kb instructions": grchatgpt.getDisplayValue('kb_instructions'),           ----  HTML 
            "kb support details": grchatgpt.getDisplayValue('u_kb_support_details'),  - HTML
          "kb  details": grchatgpt.getDisplayValue('kb_introduction'),     - HTML
           

        };
        val.push(res);
    }
    response.setBody(val);

})(request, response);
 
Regards, 
Rushi
1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Rushi2 Please use the updated code and see if it works for you.

(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
    var val = [];
    // implement resource here//
    var grchatgpt = new GlideRecord('kb_knowledge');
    grchatgpt.addEncodedQuery("workflow_state=published^kb_knowledge_base=100c36a80f115244272e244be1050e88");
    grchatgpt.orderByDesc('sys_updated_on');
    grchatgpt.query();
    while (grchatgpt.next()) {
        var abc = grchatgpt.kb_introduction.toString();
        var res = {
            "Number": grchatgpt.getValue('number'),
            "knowledge base": grchatgpt.getDisplayValue('kb_knowledge_base'),
            "valid to": grchatgpt.getValue('valid_to'),
            "short description": grchatgpt.getValue('short_description'),
            "Assignment group": grchatgpt.getDisplayValue('u_assignment_group'),
            "Internal notes": grchatgpt.getValue('u_internal_notes'),
            "kb instructions": grchatgpt.getValue('kb_instructions'),          
            "kb support details": grchatgpt.getValue('u_kb_support_details'),  
          "kb  details": grchatgpt.getValue('kb_introduction')
        };
        val.push(res);
    }
    response.setBody(val);

})(request, response);

View solution in original post

6 REPLIES 6

Hi Sandeep, 

 

I am getting like below. how can I convert that to string ?

 "kb instructions": "<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">If you need local assistance to Install/Move/Dispose of a computer for the first time or an existing computer, you need to <strong>create a Request</strong>, instead of an Incident. </span></p>",
      "kb support details": "<p><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">The request needs to be created using the \"<strong>My Computer</strong>\" catalog request, located under the \"<strong>Personal Computing</strong>\" Category in the Service Request Catalogs.</span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Go to&nbsp;<a title=\"IT ServiceNow Home Page\" href=\"https://dupont.service-now.com/sp\" target=\"_blank\" rel=\"noopener\">IT ServiceNow Home Page</a></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Click on&nbsp;<strong>Personal Computing &mdash;&gt; My Computer</strong></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Once in the <strong>My Computer</strong> Catalog, select the&nbsp;<strong>Requested Action</strong></span><br /><br /><br /><img src=\"/sys_attachment.do?sys_id=077914cfdb113d506697c59b13961929\" alt=\"\" width=\"497\" height=\"226\" /><br />\r\n<p style=\"margin: 0cm 0cm 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\"><span style=\"font-size: 12pt; line-height: 107%;\">Submit a request to expose the Temp Admin script within Software Center so that the user may download approved software.</span></p>\r\n<p style=\"text-align: center; margin: 0cm 0cm 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\"><img src=\"/sys_attachment.do?sys_id=8dd12c0fdb913d506697c59b1396192c\" /></p>\r\n<p style=\"margin: 0cm 0cm 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\"><strong><em><span style=\"font-size: 12pt; line-height: 107%;\">NOTE</span></em></strong><em><span style=\"font-size: 12pt; line-height: 107%;\">:&nbsp; If you need elevated rights for something that is not on the list, your manager&rsquo;s approval will be required, followed by both a security and a licensing review.&nbsp; The security and licensing reviews may take up to two weeks to complete.</span></em></p>\r\n<p style=\"margin: 0cm 0cm 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\"><span style=\"font-size: 12pt; line-height: 107%;\">If your request is approved, you will receive an email notification from &ldquo;IT Service Desk&rdquo; stating that you will be able to see the Temp Admin script in Software Center within 4 hours of the approval.&nbsp;</span></p>\r\n&nbsp;</li>\r\n</ol>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 12pt;\"><strong>How to Move my PC?</strong></span></p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">After choosing <strong>\"Move my PC\"</strong>&nbsp;above, you will have to provide these details:</span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Date desired for move: YYYY-MM-DD HH:mm:ss</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Computer Service Tag to be moved.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Provide Current Office location.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Provide Future Office location.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Business Justification</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Do you have any special instructions?</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Click <strong>\"Order Now\"</strong></span></li>\r\n</ol>\r\n<p>&nbsp;</p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 12pt;\"><strong>How to Dispose of my PC?</strong></span></p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">After choosing <strong>\"Dispose my PC\"</strong> above, you will have to provide these details:</span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Requested pick-up date.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Computer Service Tag to be disposed.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Delivery address</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Business Justification</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Do you have any special instructions?</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Click <strong>\"Order Now\"</strong></span></li>\r\n</ol>\r\n<p>&nbsp;</p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 12pt;\"><strong>How to Dispose a PC who belonged to someone else who has left the company?</strong></span></p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">After choosing <strong>\"Dispose a PC who belonged to someone else who has left the company\"</strong> above, you will have to provide these details:</span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Requested pick-up date: YYYY-MM-DD HH:mm:ss</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Name of the user who left the company and was associated with the PC to be disposed</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Computer Service Tag to be disposed</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Do you have any special instructions?</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Click <strong>\"Order Now\"</strong></span></li>\r\n</ol>\r\n<p>&nbsp;</p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 12pt;\"><strong>How to Request a new PC/Replace an Existing PC?</strong></span></p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">After choosing <strong>\"Request a new PC/Replace an Existing PC\"</strong> above, you will have to provide a reason for requesting a new PC:</span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"box-sizing: border-box; font-size: 10pt; font-family: arial, helvetica, sans-serif;\"><span style=\"color: black;\">&nbsp;<img style=\"max-width: 100%; max-height: 480px;\" src=\"/sys_attachment.do?sys_id=efcaf82e1b94e59c30419827bc4bcb22\" /></span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\">&nbsp;</p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"font-size: 12pt;\"><strong>New Employee/Contractor&nbsp;</strong></span><br />You will have to provide the following details:<br /></span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Date of joining: YYYY-MM-DD HH:mm:ss<br /></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Delivery address</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Business Justification<br /></span></li>\r\n<li style=\"font-size: 12pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Do you have any special instructions?</span></li>\r\n</ol>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><strong><span style=\"font-size: 12pt;\">New Lab Computer / New Shared Computer</span><br /></strong>You will have to provide the following details:<strong><br /></strong></span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Delivery address</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Business Justification<br /></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Do you have any special instructions?</span></li>\r\n</ol>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><strong><br />For any other item</strong>, you will have to provide the following details:<br /></span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\"><span title=\"\" data-placement=\"right\" data-toggle=\"tooltip\" data-original-title=\"\">Lost or stolen Computer Service Tag/Existing Computer Service Tag</span></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Delivery address</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Business Justification<br /></span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Do you have any special instructions?<br /></span></li>\r\n</ol>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Once you have chosen the reason for requesting a new PC, you will have to determine <strong>\"</strong><strong>What replacement device are you requesting/What are you requesting?\"</strong>.</span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><img style=\"max-width: 100%; max-height: 480px;\" src=\"/sys_attachment.do?sys_id=e45bbc6e1b94e59c30419827bc4bcb40\" /></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\">&nbsp;</p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><strong>For both Standard Laptop and Non-Standard Laptop,&nbsp;</strong>you will have to check the corresponding boxes under \"<strong>What components do you need?\"</strong><em><strong>&nbsp;</strong></em>as shown below.</span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\">&nbsp;</p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><img style=\"max-width: 100%; max-height: 480px;\" src=\"/sys_attachment.do?sys_id=d0bacd2e1b58e59c30419827bc4bcb81\" /></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><strong><br />For both Non-Standard Laptop and Non-Standard Desktop, </strong>you will have to confirm the following specifications:</span></p>\r\n<ol style=\"list-style-position: inside;\">\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Choose the model of the device.</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Memory</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Hard Disk</span></li>\r\n<li style=\"font-size: 10pt;\"><span style=\"font-size: 10pt; font-family: arial, helvetica, sans-serif;\">Charge Code</span></li>\r\n</ol>\r\n<p>&nbsp;</p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">Once you have filled out all the required fields, you can submit your request by clicking on <strong>\"Order Now\"</strong>.</span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"box-sizing: border-box; font-size: 10pt; font-family: arial, helvetica, sans-serif;\"><span style=\"color: black;\">This request will automatically be assigned to Field Services. In the case of Disposal, two tasks will be created (Install &amp; Disposal)</span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\">&nbsp;</p>\r\n<p style=\"margin: 0in 0in 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"line-height: 107%;\">If you have further needs which are not addressed by this article, please contact the&nbsp;</span><a style=\"color: #0563c1;\" title=\"Service Desk\" href=\"https://dupont.service-now.com/sp\" target=\"_blank\" rel=\"noopener\"><span style=\"line-height: 107%;\">Service Desk</span></a><span style=\"line-height: 107%;\">&nbsp;using \"Live Chat\" option.</span></span></p>\r\n<p style=\"margin: 0in 0in 8pt; line-height: 107%; font-size: 11pt; font-family: Calibri, sans-serif;\">&nbsp;</p>",
      "kb  details": "<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #ff0000;\">**No Re-imaging of assets** Ensure that the EU is educated on this policy and that it's understood they will be receiving a new asset via the refresh.</span></p>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"color: black;\"><strong>Note:</strong> Disposal are done by the end-user, but you could go ahead and assist <a title=\"KB1021055\" href=\"https://dupont.service-now.com/sp?id=kb_article_view&amp;sysparm_article=KB1021055\" target=\"_blank\" rel=\"noopener\">KB1021055</a></span><span style=\"box-sizing: border-box;\"><span style=\"color: blue;\"><span style=\"color: black;\"> to request disposal of a computer or any other hardware device</span></span></span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\">&nbsp;</p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"box-sizing: border-box; font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"color: black;\">Category: Should be handled by a service request (My Computer)</span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"box-sizing: border-box; font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"color: black;\">Subcategory: Should be handled by a service request (My Computer)</span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"box-sizing: border-box; font-family: arial, helvetica, sans-serif; font-size: 10pt;\"><span style=\"color: black;\">Configuration Item:&nbsp; Should be handled by a service request (My Computer)</span></span></p>\r\n<p style=\"margin: 0in 0in 6.75pt; background: white; font-size: 12pt; font-family: 'Times New Roman', serif;\"><span style=\"font-size: 10.0pt; font-family: Arial, sans-serif; color: black;\">Second Level Support: Field Service assignment is based on user location in ServiceNow.&nbsp; To determine the appropriate assignment group please reference <a style=\"color: #0563c1; text-decoration: underline;\" title=\"KB1021739\" href=\"https://dupont.service-now.com/sp?id=kb_article_view&amp;sysparm_article=KB1021739\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #0563c1;\">KB1021739</span></a> and using the user location, select the appropriate group.</span></p>"
    }

 

@Rushi2 Simply use the following code to remove html tags from your string.

var html = '<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 10pt;\">If you need local assistance to Install/Move/Dispose of a computer for the first time or an existing computer, you need to <strong>create a Request</strong>, instead of an Incident. </span></p>';

gs.info(html.replace( /(<([^>]+)>)/ig, '') );

Updated your code accordingly.