Fields showing sys_id instead of String Value

sharmavikrant
Kilo Expert

We have an issue where in the fields are showing sys_ids instead of String value after the incident are closed.

The value are showing as sys_ids for the users who are not admins.

However, for Admins as well the list view also shows the sys_id and if you look in the individual form as an Admin it will show you the string values in the field.

 

Any suggestion?

1 ACCEPTED SOLUTION

Hi Vikrant,



If the tables containing the Business-service and Department records are not regularly erased and reimported, there should be no problem creating reference choice lists that point to them. However, if you don't need to source other data from those tables (via related fields etc), and it's simply the display value that you wish to retain/show on your Incident form, you could revert back to the String Choice field type, and populate the field with choices when the form loads. I've done this before using a combination of onDisplay Business Rule,   g_scratchpad object, and an onLoad client script.



The basic idea is to use the onDisplay Business Rule to run a glide record query on the table you are sourcing the values from (e.g Department), then collect the display values from these records into an array. Attach the array to the g_scratchpad object so that it becomes accessible by client scripts when the form has loaded. Then add an onLoad client script which reads the array from the g_scratchpad object and "adds" the choices to the "Department" choice list field on the incident form using g_form.addOption(). The advantage to doing this is that your choices will always remain up to date with the source table data, however the values stored in the Incident ticket will remain string values (not sys_ids etc).



See the following links from the ServiceNow Wiki for more information:


GlideForm_(g_form) - addOption()


Client_Scripts - onLoad


Business Rules - Display



Regards,


Jake


View solution in original post

9 REPLIES 9

Hi Vikrant,



Reverting back to a choice list (e.g changing the field type from Reference to String or Choice) would resolve the sys_id issue because that field type does not store them. However I think that would be a last resort. It sounds like your issue is definitely ACL related, so I would recommend disabling all relevant ACL's (table and field level) on the referenced table and then checking if the issue is resolved. If this resolves the issue, start enabling the ACL's again one at a time. When the problem appears again, you'll know which ACL is causing the issue and can hopefully modify it's conditions to suit your requirements. You could enable Security Debugging as well to provide more detail. If disabling all of the relevant ACL's does not resolve the issue, I would try changing the Display field on the referenced table. If you change the Display field to another field, it should be reflected in your reference field (in form and list view). If this resolves the issue (e.g Display value present when it should be) then the problem is related to the specific field which you previously had marked for Display.



Regards,


Jake


Thanks Jake, I have made some changes with the fields. However, as we still want the fields to refer to some of the tables. business-service and the Department. I was also bit vague about the fields as the fields were choice list in the beginning itself however, instead of having their own choice list, it refers to the   business-service and the Department tables fetching the values for the choice list from that table. Does that make any difference?


Hi Vikrant,



If the tables containing the Business-service and Department records are not regularly erased and reimported, there should be no problem creating reference choice lists that point to them. However, if you don't need to source other data from those tables (via related fields etc), and it's simply the display value that you wish to retain/show on your Incident form, you could revert back to the String Choice field type, and populate the field with choices when the form loads. I've done this before using a combination of onDisplay Business Rule,   g_scratchpad object, and an onLoad client script.



The basic idea is to use the onDisplay Business Rule to run a glide record query on the table you are sourcing the values from (e.g Department), then collect the display values from these records into an array. Attach the array to the g_scratchpad object so that it becomes accessible by client scripts when the form has loaded. Then add an onLoad client script which reads the array from the g_scratchpad object and "adds" the choices to the "Department" choice list field on the incident form using g_form.addOption(). The advantage to doing this is that your choices will always remain up to date with the source table data, however the values stored in the Incident ticket will remain string values (not sys_ids etc).



See the following links from the ServiceNow Wiki for more information:


GlideForm_(g_form) - addOption()


Client_Scripts - onLoad


Business Rules - Display



Regards,


Jake


Thank for your support Jake. Your advise would be really helpful.


Hi Guys We are doing integration Between Two Snow instances,everything going very well but the issue...



You answer is very closer to me, but one small write where should i hav to write the business rule, is it in target instance on source instance?