Process Flow Formatter Hover Text

Sean Burton
Tera Expert

Is it possible to add hover text to each stage in a process flow formatter? I want to use the description and assume I need to adjust the macro for process_flow, but not sure how. 

2 REPLIES 2

GregJWillis
ServiceNow Employee
ServiceNow Employee

There are 3 places that need to be adjusted.  All are OOB scripts.  So warning on the Upgrade / Customization approach:

 

1) UI Macro: "process_flow" record needs to be edited with the following:

The line that has:

       <a href="javascript&colon;void(0);" tabindex="-1" role="presentation"
aria-label="$[jvar_flow_stage] $[jvar_flow.getLabel()] $[jvar_flow_step]">

 

Replace with:

     <a href="javascript&colon;void(0);" title="$[jvar_flow.getParameter('description')]" tabindex="-1" role="presentation"
aria-label="$[jvar_flow_stage] $[jvar_flow.getLabel()] $[jvar_flow_step]">

 

 

2) For each table that has a Process Flow, there is a matching Global Business Rule called:          <tableName>_ProcessFlowList

(e.g.  Demands would have a a BR called 'dmn_demand_ProcessFlowList')

You have to edit each one you want to have the added Hover text by adding the following code:

Just after these lines:

if (match)
choice.setParameter('state', 'current');
else
choice.setParameter('state', 'future');

 

insert this:
choice.setParameter('description', gr.description);

 

 

3) To get rid of the pesky <p> and </p> characters in the OOB descriptions, just edit each record in the table 'sys_process_flow' (found in the module 'Process Flow'.  Find the desired table's data.  And edit each record's Description field by clicking the 'Toggle HTML Source' button.  Then deleting the '<p>' on the front and the '</p>' on the back.  And save.  The tags won't be put back as long as you don't try to add html formatting back.  You can then edit the description to something more meaningful which I am sure why you wanted to have this hover in the first place.  

 

That's it.  Worked for me.

GregJWillis
ServiceNow Employee
ServiceNow Employee

I realized that there have been some changes in the back-end regarding 'HTML' field types and apparently recently the "<p>" tags are added back after trying to edit them out.  

 

So, replace this line of code in step 2):

 

choice.setParameter('description', gr.description.replace(/(<([^>]+)>)/gi, ""));