State Change to "New" – Info Message Requirement

shubhi_shubhi
Kilo Sage

Hi team,

 

There is a requirement for the rm_enhancement table: whenever the state changes to "New", an informational message should be displayed to the user when they open the record( user will not open the record immediately), indicating that the state has been updated to New.

 

State will get changed by the script not manually updating the state

 

Currently, we do not have the option to create a new field to track this state change (e.g., a flag such as "state changed to New").

 

Please suggest possible approaches to implement this behavior without introducing a new field.

 

**We are not using rm_enhancement for Agile Story or anything related to Story

 

Thanks,

4 REPLIES 4

Tanushree Maiti
Tera Patron

Hi @shubhi_shubhi 

 

1)To create new enhancement following roles are required,

 

Before you begin

Role required: Any one of the feature_user, scrum_story_creator, scrum_admin, or rm_enhancement_admin roles

 

Ensure you are not assigning  above roles to your end user so that they can create new.

 

2) To display a message every time an existing enhancement record is accessed, use a Client Script and check for the desired state. 

  • Table: rm_enhancement
  • Type: OnLoad

 

function onLoad() {

    var currentState = g_form.getValue('state');

        if (currentState == '4')  //update New state’s value

{

        g_form.addInfoMessage("Your custom info message goes here.");

    }

}

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

we are using rm_enhancement table for different use

Hi @shubhi_shubhi 

 

For getting the correct solution , you need to mention -  for what purpose you are looking for this customization. what is the business justification for this requirement .

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

joshuajacks
Tera Guru

Hey @shubhi_shubhi If auditing is enabled for the table, you could query the "sys_history_line" table in a script include for the change to "New" on an onLoad client script. Then show the message if the script include returns true.