How to add hyperlink for g_form.showFieldMsg display message

poornima batchu
Tera Expert

Hi all, 

I'm trying to add a hyperlink for g_form.showFieldMsg which redirects to a portal. I have seen in the community it is not possible for showfiledMsg. client is expecting only display message they are not okay to add it as an info message

Could anyone suggest the best alternative ways to achieve this? 

17 REPLIES 17

@poornima batchu , in that case you have explain to client about the limitation or go with alternate options, there is no other way, you can open a case with ServiceNow Support for client reference. 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Marco0o1
Tera Sage

Hi @poornima batchu ,

 

I can recomend to build the element from 0, there is a example to redirect to the /esc below the cmdb_ci field in the incident table, i use a client script onLoad:

 

function onLoad() {

  var existingElement = document.getElementById("element.incident.cmdb_ci");

    // Create a new anchor (a) tag
    var anchorTag = document.createElement("a");

    // Set the href attribute for the anchor tag
    anchorTag.href = "/esc";

    // Set the text content for the anchor tag
    anchorTag.textContent = "Employee Portal";

    // Set the style for the anchor tag
    anchorTag.style.textDecoration = "none";
    anchorTag.style.color = "#000";
    anchorTag.style.display = "block";
    anchorTag.style.padding = "10px";
    anchorTag.style.borderRadius = "5px";
    anchorTag.style.textAlign = "center";

    // Insert the new anchor tag after the existing element
    existingElement.insertAdjacentElement('afterend', anchorTag);
}

Just make sure have the "Isolate Script" field turn to off and you can add the styles manually.

 

Marco0o1_0-1701793700191.png

 

@Marco0o1 , i tried but it giving me Java Script error , seems like DOM parsing issue. 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution