- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 08:54 AM
Hello: I have the code below on a workflow. The code is working but I need to populate the following fields: "Requested For", "Category" and "Subcategory". Any suggestions on how to do this?
inc = new GlideRecord('incident'),
fs_desc = s_descritpion1.concat(" ", location);
f_desc = Incident_description.concat(" : ", name);
inc.initialize();
inc.short_description = fs_desc;
inc.description = f_desc;
inc.assignment_group = 'ABCD';
inc.insert();
Thanks,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 10:34 AM
Then something like:
inc.requested_for = gs.getUserID();
Do check what the correct field name is though. Because out-of-the-box there's no requested_for on Incident, there should be a caller_id field. But you can check that.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 10:34 AM
Then something like:
inc.requested_for = gs.getUserID();
Do check what the correct field name is though. Because out-of-the-box there's no requested_for on Incident, there should be a caller_id field. But you can check that.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 10:42 AM
inc.caller_id = gs.getUserID();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 10:46 AM
It would be appreciated if you mark my last answer as correct instead of your own.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 09:13 AM
I would suggest just use:
inc.requested_for = current.request.requested_for;
inc.category = "backend_value_of category";
inc.subcategory = "backend_value_of subcategory";
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 09:32 AM