To add Dynamic field values to the redirect url of the UI Action button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 02:32 AM - edited 10-19-2025 05:13 AM
Hi All,
can you please help the below UI Action script in the new window also fill in:
- Sub PTASK type = same as the Investigation PTASK
- Cause code and Sub cause code = same as the Investigation PTASK
UI Action:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 02:54 AM
Hi @sureshp89882164 ,
Add below code snippet after record insert
// Insert the record first
var newRecordSysId = rec.insert();
// Open in new window instead of redirecting current window
var newRecordUrl = rec.getLink(true);
// Use client-side script to open in new window
var script = "window.open('" + newRecordUrl + "', '_blank');";
// Alternative approach - set redirect but with target blank
action.setRedirectURL(newRecordUrl + '&sysparm_target=_blank');
Refer the below post:
UI action to open in new window/Tab
Create link of record in UI action and Redirect
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2025 05:18 AM
Hi Shankar,
Thanks for the below solution.
As per check looks like it is not working as per my requirement.
need to redirect to below url (new window) along with autopopulate "cause code" and "sub cause code" from the current record "rec".
action.setRedirectURL('problem_task.do?sys_id=-1&sysparm_query=problem_task_type=remediation');
