The CreatorCon Call for Content is officially open! Get started here.

How to pull data of a custom table in the catalog item variable?

akshay parekar1
Tera Contributor

Hello everyone,

I have created one table with following fields: 

User ( reference to sys_user), Total Leaves, Taken Leaves, Remaining Leaves and also created some records for this table

Then, i have created a catalog item with few variables in which there are all the above fields of my custom table also as variables

Now , requirement is that whenever any user logs in , his userID should get auto populated in user variables and the all three variables of leaves which are Total Leaves, taken leaves and remaining leaves should get auto filled fro my custom table

Hope you guys got my question, please help me out

3 REPLIES 3

Anubhav24
Mega Sage

Hi  Akshay,

To achieve this you need a onload client script which will call a script include to fetch the data from backend and populate it on front end.

or

You can put below statements : javascript:gs.getUser().getRecord().getValue('phone_number'); in the default value tab of that respective variable.

Let me know if you need help with the script.

Kindly mark helpful if this answer helped you.

Community Alums
Not applicable

Hi @akshay parekar ,

Refer to the script mentioned in this thread , should help you :

https://community.servicenow.com/community?id=community_question&sys_id=17f9c193dbe0e010f21f5583ca96...

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

Community Alums
Not applicable

Hi @akshay parekar ,

Any update to this ?Any follow-up required? if not

Kindly mark the answer as Correct & Helpful both such that others can get help.

Thanks,
Sandeep