Set reference field value in UI page and show i icon aside of it.

Abhijit4
Mega Sage

Hello Everyone,

I have reference field in UI page where I am setting the value as below,

<g:ui_reference name="module" id="module" table="u_nowmodule"/>

gel('module').value='7cf7a0861be55c50191adc6a9b4bcb1d';
gel('sys_display.module').value='Incident Management';

this sets the value fine but it is not showing i icon beside it. Please refer below image,

Any help would be appreciated.

Thanks.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

1 ACCEPTED SOLUTION

Hi Rich,

can you try to add this 1 line after your existing and it should work fine.

gel('module').value='7cf7a0861be55c50191adc6a9b4bcb1d';
gel('sys_display.module').value='Incident Management';

gel('moduleLINKreplace').style.display = "";

Regards
Ankur

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I had faced similar issue in past.

Can you share the complete script

Regards
Ankur

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

Hi Ankur,

 

Thanks for your reply.

I cannot share the complete script, but I would like to explain,

I have one reference field in html

<g:ui_reference name="module" id="module" table="u_nowmodule"/>

 

In the client script, I am setting its value as below while loading the page,

gel('module').value='7cf7a0861be55c50191adc6a9b4bcb1d';
gel('sys_display.module').value='Incident Management';

It is setting value fine but it is not showing i icon.

 

The above sys_id and Display value available in the referenced table.

 

let me knwo if you need any more details.

 

Thanks.

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Hi Rich,

can you try to add this 1 line after your existing and it should work fine.

gel('module').value='7cf7a0861be55c50191adc6a9b4bcb1d';
gel('sys_display.module').value='Incident Management';

gel('moduleLINKreplace').style.display = "";

Regards
Ankur

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

Thank you so much Ankur,

By inspecting it I found that icon id is 'moduleLINK' not 'moduleLINKreplace', so below line worked for me,

gel('moduleLINK').style.display = "";

 

Thanks.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP