Populating the sys_id into a Field

turnea
Mega Expert

Hi everyone,

 

We're running into some issues where we are storing data between CMDB and another external database.   That DB is pulling information from the CMDB, however it was discovered that if we have a name change regarding an application, it would not recognize that it was updated and could cause some issues.   What we were thinking the fix could be would be to have a field that populates that application's sys_id, so they can reference that instead of the name.   It's proving to be a bit difficult from what we've seen however I don't think it should be as the sys_id is readily available in URLs etc.   Does anyone know how we can populate the sys_id into a field?

 

Thank you,

Amandah

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Amandah,



If you want to populate sys_id to a field and want the field to have the name as display value.



g_form.setValue('<fieldname>', <sys_d>);



this field where you are populating the sys_id should be a reference to that table whose record you are showing, in your case cmdb_ci.


-Anurag

View solution in original post

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Amandah,



If you want to populate sys_id to a field and want the field to have the name as display value.



g_form.setValue('<fieldname>', <sys_d>);



this field where you are populating the sys_id should be a reference to that table whose record you are showing, in your case cmdb_ci.


-Anurag

Hi Anurag,



That's great, thanks!   Quick question though, would this script be put directly into the field itself somehow or would it be a separate client script?   It would easily reference each individual record from there?   I feel like this may be a bit of a stupid question but just figured I'd clarify!


onload client script or onload ui policy would do.


-Anurag

That's perfect - thank you so much!   I'll give it a try.