UI Action to link REQ with Interaction
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 03:53 AM
I have a requirement to create a custom UI action called "Create Request" button on 'Interaction' record.
upon clicking on 'Create Request' button the following action should happen.
1. It should be redirected to the catalog item page in service portal. and user can select any catalog item and 'Requested for' variable should be copied as 'Opened for' from the 'Interaction' record .
l
2. After submission of the catalog item, Request (REQ) should be linked with 'Interaction' record as below.
Thanks!
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 04:14 AM
Hi,
so where are you stuck?
what did you start?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 05:02 AM
Hi @
You can send url of catalog item and sending opened for sys_id in the URL
for eg. -
url = "sp?id=sc_cat_item&sys_id=060f3afa3731300054b6a3549dbe5d3e" + "&sysparm_opened_for_sys_id=" + current.opened_for;
action.setRedirectURL(url);
Write onload client script check the below link fetch data from url to client script and set requested for variable as a opened for.
https://community.servicenow.com/community?id=community_question&sys_id=6426e7e2dbf13c14679499ead39619f4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 05:33 AM
Hi Ankur,
Issue is I'm not able to pass 'Opened for' value from the 'Interaction' record to selected catalog item and after submission of the catalog item I'm not able fetch REQ number/REQ SysId back to UI action in order to link REQ with Interaction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 06:19 AM
Hi,
Did you check the OOB UI action
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 08:23 AM
Hi Ankur,
I did, The OOB UI action takes to the below itil/backend page, here it allows to select catalog item and after ordering catalog item automatically links Interaction record with REQ.
But my concern is I wanted to redirect to the service portal catalog item page and after submission of catalog item, I need to get the REQ sysid back to the UI action.
Here is my current script:
Name : Create Request
Table: Interaction
Show Update :True
Form button :True
script:
var url;
var activeCatalogsCount = sn_sc.Catalog.getCatalogCount();
if (activeCatalogsCount === 1) {
url = "catalog_home.do?sysparm_view=catalog_default&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;
//url = "sp?id=sc_category&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;
} else {
url = "catalogs_home.do?sysparm_view=catalogs_default&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;
//url = "sp?id=sc_category&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id ;
}
action.setRedirectURL(url);