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
3 weeks ago - last edited 3 weeks ago
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
3 weeks ago
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
3 weeks ago
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');
