We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

same name should be in both fields

aggarwaltan
Tera Contributor

I want make Assign_to filed and resolved_by filed mandatory and no different names should assign in them , 

if different name occurs it  is unable to submit the form . 

5 REPLIES 5

Dr Atul G- LNG
Tera Patron

Hi @aggarwaltan 

 

To make it mandatory you can use UI policy and also check in UI policy if assigned To is not same resolved By, show error message. 

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

Hitoshi Ozawa
Giga Sage

@aggarwaltan You probably don't want assign_to and resolved_by fields mandatory when the form such as a request or an incident is created because resolved_by can't be filled in until it is resolved.

Probably want to have assigned_to and resolved_by fields to be filled when the state changes to "Resolved".

In this case for example on table Incident, edit business rule "mark_resolved".

function setResolutionFields() {
  if (current.assigned_to.nil())
    current.assigned_to = gs.getUserID();
   current.resolved_by = current.assigned_to;
   if (current.resolved_by.nil())
      current.resolved_by = gs.getUserID();

 

Runjay Patel
Giga Sage

Hi @aggarwaltan ,

 

You can write on submit client script like below. I have added condition that it should prevent submission on ticket resolve.

 

RunjayPatel_0-1730441490786.png

function onSubmit() {
    var state = g_form.getValue('state');
    if (state == 6) {
        if (g_form.getValue('assigned_to') != g_form.getValue('resolved_by')) {
			g_form.addErrorMessage('Assigned to and resolved by should be same.');
           return false;
        }
        
    }



}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Part 1. This video serves as the introductory episode of the ServiceNow Fundamental Course playlist. Here, I've outlined the course content that I'll be delving into throughout this series. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on ...

Thank you for answering, you made my day.

https://academized.com/buy-argumentative-essay academized. The process was easy, and the quality of the essay exceeded my expectations. The writer presented clear and logical arguments, supported by reliable sources.