Field decorations / Reference contributions not working for certain (reference) field

Walt Janssens
Tera Contributor

Hi,

I have a working UI Macro on the incident form which sets the assignment group field to the support group of the currently selected CI.
When I add it as field decoration / reference contribution to for example the customer (reference) field, it shows on the form, and does exactly what I want it to do.
When I add it to the assignment group (reference) field, it does not show.

Does anyone have an idea how to fix this?

With kind regards.

22 REPLIES 22

Hi,

any error in browser console when form loads?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

No.

try to remove the UI macro from other 2 fields and just keep assignment group and check if it works

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I already tried that but it does not work.

can you share the browser console when form loads?

Did you try creating fresh UI macro with different name, same code and replace with this and try once

use this to create new macro and add this one

I have changed the function name

addSupportGroup1()

<?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_support_group"/>

   <span id="${jvar_n}" onclick="addSupportGroup1()" title="Add Support Group" alt="Add Support Group" tabindex="0" class="btn btn-default icon-user-group">
      <span class="sr-only">Add Support Group</span>
   </span>

   <script>
	   function addSupportGroup1() {
		var supportGroup_id = g_form.getReference('u_reported_ci').support_group;   
	        var supportGroup = new GlideRecord('sys_user_group');
	        supportGroup.get(supportGroup_id);
	        var sys_id = supportGroup.sys_id;
	   	   
	        if(supportGroup){
		             g_form.setValue('assignment_group', sys_id);
	        }
	  	
          }
   </script>
	 
</j:jelly>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader