how to show in percentage in "Percent complete" feild in servicenow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 02:30 AM
There is a Field "% Savings" - type = Percent Complete.
I calculate the value and set the value to this field.
When I try to set its value to 35% , it is just taking 35 .
But I need to display this as 35%.
Please guide me in this.
Thanks,
Bharath
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 01:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 11:58 AM
Hi @Naveen Kumar ,
I made some testing and I create a HTML element with % simulating the value, there is how to do:
- Create a Client Script On Load for your table:
- Make sure you have the "Isolate Script" on false.
- Add the code, replace the "table_name" and "field_name" with your table and field.
function onLoad() {
var table_name = "u_testing_table"; //There is necessary to write the table you are using
var field_name = "u_porcentage"; //There is the field you want to add the %
var inputElement = document.getElementById(table_name+"."+field_name);
var percentPseudoElement = document.createElement("span");
percentPseudoElement.style.fontWeight = "bold"; // Adjust the font weight as needed
percentPseudoElement.style.width = "10px";
percentPseudoElement.textContent = "%";
// Traverse up the DOM tree to the parent's parent of the input element
var parent = inputElement.parentElement;
if (parent) {
parent.style.position = "relative";
parent.style.display = "flex";
parent.style.flexWrap = "nowrap";
parent.appendChild(percentPseudoElement);
}
}
- There is how it look for me:
You can change the element to other size or colors, but this would work f you only want to visualice, you can combine with the field Percent Complete Field Type to visualice in the list view, and in the form view look the % I suggest.
Hope that help you