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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you will have to change the logic within the macro since both the fields to which you are adding the macro are different

one refers to customer table and other refers to group table

Regards
Ankur

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

It renders for most fields, except for assignment_group. I think this has nothing to do with it not rendering.

This is my UI Macro:

<?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="addSupportGroup()" 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 addSupportGroup() {
		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>

Hi,

this is added to which field?

Regards
Ankur

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

It works for most fields, for example u_reported_ci and u_customer, but not for the field assignment_group on which I wanted to add it in the first place.