Make fields mandatory in list view

AbidJafrey
Tera Contributor

Hi all,

 

Could you help me with how to make fields mandatory in list view when user tries to resolve it from list view, the fields to be mandatory are ci,close code and close notes.

Note: Need help to achieve without UI Policy as it is affecting the integration updates.

 

Thanks

Abid

14 REPLIES 14

Sanjay191
Tera Sage

Hello @AbidJafrey 
Use the oncellEdit client script for this requirement and make the changes accordingly 
if any thing else please let me know

If you found this helpful, please give a thumbs up OR mark it as the solution. Thank you!


Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @AbidJafrey 

 

You can use the oncell edit client script and add the condition. 

 

  • function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
     var saveAndClose = true;
     var isAdmin = g_user.hasRole('admin');
    
        if ((!isAdmin && newValue == 2) || (!isAdmin && newValue == 3)){
             alert('Not allowed to set this state');
             saveAndClose = false;
        }
     
     callback(saveAndClose); 
    }
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

We dont have to stop the incident from resolving, instead we have to make them fill the close code, close notes and configuration item field

Hell @AbidJafrey 
your logic is like

if(state == 'backend value of resolved')

if(cmdb_ci == '' && close_code == '' && close_notes == ''){
  put error msg to fill out the ci,close codes and close notes
 saveAndClose = false;

}

else{

  saveAndClose = true;

}

please take the help from this logic and make the changes accordingly and let me know if anything else

 

If you found this helpful, please give a thumbs up OR mark it as the solution. Thank you!