- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 04:59 AM
Hi Developers/ @Ankur Bawiskar
This is related to one of the tricky requirement which I need to build.
I need to call an API on the load of a catalog form and the response I need to store in one of the catalog form field which is a drop down options field.
Please let me know how I can achieve this type of requirement.
Step by Step explanation would be helpful and also a type of sample code.
Thanks in Advance !!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 02:26 AM
@Rahul84 Have you tried this? if yes then please close the thread by marking all correct answers
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 12:57 AM
@Rahul84 Yes that code should work but
if you need user name of logged in user then use below line
gs.getUser().getName();
If you you want user sys_id then user any one of below 2 lines
gs.getUser().getID();
OR
gs.getUserID()
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 01:30 AM
@jaheerhattiwale , I need to pass the userid of the user as the query paramenter in the API url.
like username=apkotha &action=add&tag=abcd
Full name as APARNA KOTHA , user id - apkotha ( combination of first name and last name).
I need to fetch the user id of the logged in user/who is loading the catalog form and need to pass that in the API url.
user id - stores in sys_user table.
Please help how we can achieve this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 01:32 AM
@Rahul84 Then use below line
gs.getUser().getName();
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 01:41 AM
Thank you for helping me and replying the queries. I am trying your solution provided.
Will let you know further queries and the result.
Please keep guiding me.
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:15 PM
@Rahul84 Did you try this?
Can you please mark all answers on this question as correct answers. If you are recent answer then at least mark the older answers as correct answers.
ServiceNow Community Rising Star, Class of 2023