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

how to assign to me an incident to myself?

Munna2
Kilo Contributor

this ticket only assign by system administrator

how can i assign this ticket?

6 REPLIES 6

asifnoor
Kilo Patron

Hello Harish,

There is already an existing UI action Assign to Me for hr_case. you can copy the same for the incident table, which gives you a button Assign to ME on your incident record. Click on that, and that incident will be assigned to you.

Mark correct/helpful if this helps.

Rahul Kumar17
Tera Guru

hi

fallow my link solve your problem

first create ui macro name add_me

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
   <j:set var="jvar_n" value="add_me_${ref}"/>
   <span id="${jvar_n}" onclick="addMe('${ref}')" title="Add me" alt="Add me" tabindex="0" class="btn btn-default icon-user-add">
      <span class="sr-only">Add me</span>
   </span>

   <g2:evaluate var="jvar_groups" expression="gs.getUser().getMyGroups()" />

   <script>
      function addMe(reference) {
         //Hide any field messages
         g_form.hideFieldMsg('assigned_to', true);

         //Check to see if the user is a member of selected group
         var aGrp = g_form.getValue('assignment_group');
         var myGroups = '$[jvar_groups]';

         if(aGrp){
            if(myGroups.indexOf(aGrp) > -1){
               //Get the user reference field and populate the current user
               var s = reference.split('.');
               var referenceField = s[1];
               g_form.setValue(referenceField, '$[gs.getUserID()]');
            }
            else{
               //Display a field error message
               g_form.showFieldMsg('assigned_to','You are not a member of the current assignment group.  Please select one of your groups and try again.','error');
            }
         }
         else{
            //Get the user reference field and populate the current user
            var s = reference.split('.');
            var referenceField = s[1];
            g_form.setValue(referenceField, '$[gs.getUserID()]');
         }
      }
   </script>
</j:jelly>

 

 

then 

Add ATTRIBUTES

 

ref_contributions=add_me

 

 

 

 

find_real_file.png

 

 

 

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar