Embed Links to Additional Comments in Flow Designer

josgarcia
Tera Expert

Hello, I am trying to embed a link to a message within Flow Designer. I was following this form but that wasn't working so I tried this below:

(function executeRule() {
    // Get the sys_id from the Flow Designer's fd_data
    var sysId = fd_data.trigger.request_item.sys_id;

    // Make sure sysId is available
    if (sysId) {
        var tableName = 'sc_req_item';  // Table name for the RITM
        var number = fd_data.trigger.request_item.number;  // Assuming you have access to the RITM number
        var baseUrl = gs.getProperty('glide.servlet.uri');  // Get the base URL of the instance
        
        // Construct the URL
        var url = '<a href="https://compass.sofi.com/esc?id=kb_article&table=kb_knowledge&sysparm_article=KB0010302">Windows 365 Cloud PC</a>';
        
        // Create the comment with the embedded link
        var comment = 'Your Windows 365 Cloud PC request has been approved. See ' + url + ' for instructions on accessing it. Please allow 60 minutes for it to complete deployment.';
        
        // Update the comments field with the constructed comment
        var gr = new GlideRecord(tableName);
        if (gr.get(sysId)) {
            gr.comments = comment;
            gr.update();
        }
    } else {
        gs.error('No sys_id found for the current record.');
    }
})();

 I am able to get the message posted but it doesn't embed the link into the comment. Can someone help enlighten me on what I am missing here?

 

Results:

josgarcia_0-1719328293400.png

Thank you

1 ACCEPTED SOLUTION

Kristen Dettman
Kilo Sage
Kilo Sage

I believe you need to add [CODE]<your html tag here>[/CODE] in order to get the comments field to recognize your HTML. Without that, it's representing your code as plain text.

View solution in original post

3 REPLIES 3

Kristen Dettman
Kilo Sage
Kilo Sage

I believe you need to add [CODE]<your html tag here>[/CODE] in order to get the comments field to recognize your HTML. Without that, it's representing your code as plain text.

That worked when I try this: 

(function executeRule() {
    // Get the sys_id from the Flow Designer's fd_data
    var sysId = fd_data.trigger.request_item.sys_id;

    // Make sure sysId is available
    if (sysId) {
        var tableName = 'sc_req_item';  // Table name for the RITM
        var number = fd_data.trigger.request_item.number;  // Assuming you have access to the RITM number
        var baseUrl = gs.getProperty('glide.servlet.uri');  // Get the base URL of the instance
        
        // Construct the URL
        var url = '<a href="https://compass.sofi.com/esc?id=kb_article&table=kb_knowledge&sysparm_article=KB0010302">Windows 365 Cloud PC</a>';
        
        // Create the comment with the embedded link
        var comment = 'Your Windows 365 Cloud PC request has been approved. See ' + '[code]' + url + '[/code]' + ' for instructions on accessing it. Please allow 60 minutes for it to complete deployment.';
        
        // Update the comments field with the constructed comment
        var gr = new GlideRecord(tableName);
        if (gr.get(sysId)) {
            gr.comments = comment;
            gr.update();
        }
    } else {
        gs.error('No sys_id found for the current record.');
    }
})();

But when clicking the link from the comment posted, it will give a 'refused to connect' screen error.

But if I copy paste the link into a new window, it'll take me to the proper screen..

josgarcia_2-1719335068997.png

 

 

 

 

Turns out that the link only doesn't work from the admin portal but works perfectly fine in the SOW and the ESC. I will consider this resolved, thank you so much!