- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 01:47 AM
Hi,
I have a request table and request_item table. The request_item table is coming as a related list in the workspace. I want to create a related list action is the request_item table called upload and when i click on that it will basically redirect to a new form where the request number from the request table will get auto populated in the new form and there will be an attachment field which will need to be mandatory. Can somebody please provide the script to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 07:51 AM
try this
function onClick() {
var url = 'https://emcitizendev.service-now.com/x/iem/tqa-workspace/record/x_iem_tqa_work_request/cf0f63f31b6f96103df95314604bcbb9/params/selected-tab-index/1/sub/record/x_iem_tqa_work_request_items/-1_uid_1/params/query/work_request_number%3Dcf0f63f31b6f96103df95314604bcbb9/extra-params/query%2Fwork_request_number%3Dcf0f63f31b6f96103df95314604bcbb9%2FparentTable%2Fx_iem_tqa_work_request%2FparentRecordSysId%2Fcf0f63f31b6f96103df95314604bcbb9';
open(url, '_blank');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 05:43 AM
did you check any OOB Related list actions?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 05:48 AM
this link will help you to create a new one
How to add records in a related list with UI builder (declarative action)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 06:53 AM - edited 02-18-2025 07:51 AM
Hi @Ankur Bawiskar ,
This is the the related list action I have created .
function onClick() {
var num = g_form.getValue('work_request_number');
var instanceName = g_form.getValue('instance_name');
var url='https://emcitizendev.service-now.com/x/iem/tqa-workspace/record/x_iem_tqa_work_request/'+num+'/params/selected-tab-index/1/sub/record/x_iem_tqa_work_request_items/-1_uid_5/params/query/work_request_number%3Dcf0f63f31b6f96103df95314604bcbb9/extra-params/query%2Fwork_request_number%3Dcf0f63f31b6f96103df95314604bcbb9%2FparentTable%2Fx_iem_tqa_work_request%2FparentRecordSysId%2Fcf0f63f31b6f96103df95314604bcbb9';
var win = top.window.open(url, '_self');
win.focus();
}
The work request number (var num = g_form.getValue('work_request_number');) is not returning anything over here. Actually this is a reference field in the item table to the request table. Is it possible to get the value before the item is created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 07:51 AM
try this
function onClick() {
var url = 'https://emcitizendev.service-now.com/x/iem/tqa-workspace/record/x_iem_tqa_work_request/cf0f63f31b6f96103df95314604bcbb9/params/selected-tab-index/1/sub/record/x_iem_tqa_work_request_items/-1_uid_1/params/query/work_request_number%3Dcf0f63f31b6f96103df95314604bcbb9/extra-params/query%2Fwork_request_number%3Dcf0f63f31b6f96103df95314604bcbb9%2FparentTable%2Fx_iem_tqa_work_request%2FparentRecordSysId%2Fcf0f63f31b6f96103df95314604bcbb9';
open(url, '_blank');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 07:53 AM - edited 02-18-2025 07:55 AM
Hi @Ankur Bawiskar ,
I tried it worked.
function onClick() {
var num = g_form.getValue('work_request_number');
var instanceName = g_form.getValue('instance_name');
var url='https://emcitizendev.service-now.com/x/iem/tqa-workspace/record/x_iem_tqa_work_request/'+num+'/params/selected-tab-index/1/sub/record/x_iem_tqa_work_request_items/-1_uid_5/params/query/work_request_number%3Dcf0f63f31b6f96103df95314604bcbb9/extra-params/query%2Fwork_request_number%3Dcf0f63f31b6f96103df95314604bcbb9%2FparentTable%2Fx_iem_tqa_work_request%2FparentRecordSysId%2Fcf0f63f31b6f96103df95314604bcbb9';
open(url, '_blank');
}
The work request number (var num = g_form.getValue('work_request_number');) is not returning anything over here. Actually this is a reference field in the item table to the request table. Is it possible to get the value before the item is created. This is to make the URL dynamic.