redirect from ui action to rtask
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi
My requirement is to generate the Rtask from incident for that i have added one ui action button inside the context menu if we click on that ui action form incident(parent) form it should land on rtask page with the mapped feild should populate on rtask .
here i'm using cart api method (cart.submitOrder)
var cartName = 'create_device_replacement_request_' + gs.generateGUID();
var cartGR = new sn_sc.CartJS(cartName);
var item = {
sysparm_id: 'd31a4ae48784c354cd83bbbf8bbb35b0',
sysparm_quantity: '1',
variables: {
select_device: current.select_device.toString(),
who_is_currently_using_the_device: current.variables.who_is_currently_using_the_device.toString(),
cellular_number_or_imei_number_found_in_device_settings: current.variables.cellular_number_or_imei_number_found_in_device_settings.toString(),
imei: current.variables.imei.toString(),
street_address: current.variables.street_address.toString(),
city: current.variables.city.toString(),
state_ref: current.variables.state_ref.toString(),
zip_code: current.variables.zip_code.toString()
}
};
var cartDetail = cartGR.addToCart(item);
var submitReq = cartGR.submitOrder(cartDetail);
cartGR.empty(cartGR.getCartID());
var reqSysId = submitReq.request_id;
var ritmGR = new GlideRecord('sc_req_item');
ritmGR.addQuery('request', reqSysId);
ritmGR.orderByDesc('sys_created_on');
ritmGR.query();
if (ritmGR.next()) {
var taskGR = new GlideRecord('sc_task');
taskGR.short_description="Device Replacement Request:" +current.number;
taskGR.addQuery('request_item', ritmGR.sys_id);
taskGR.orderByDesc('sys_created_on');
taskGR.setLimit(1);
taskGR.query();
if (taskGR.next()) {
action.setRedirectURL(taskGR);
} else {
action.setRedirectURL(ritmGR);
}
}
after using this code it's not landing to ritm page instead of RTASK page.
Is there any way for my issue.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
27m ago
Hello,
Below code is responsible for redirecting the page.
if (taskGR.next()) {
action.setRedirectURL(taskGR);
} else {
action.setRedirectURL(ritmGR);
}
This check if the task is exist. If yes then it redirect to task otherwise it redirects to RITM. Instead of the above code use only the redirection to ritm alone as below
action.setRedirectURL(ritmGR);
This will ensure the page is redirected to RITM always
Thank you,
Palani
Palani
