Open Category in the ServiceCatalog through UI Action in CSM Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 08:05 AM
Hi All.
I wanted to make the "Create Request" UI Action for CSM Workspace.
I found out about the "g_service_catalog" API but in the Documentation here is only one Function defined.
I was able to open the Service Catalog with the function "openCatalogItem", like the function name says it's for opening a Catalog Item and not a Service Catalog.
In the UI Action I use:
g_service_catalog.openCatalogItem('sc_cat_item', '-1', params);
as Param is the Parent Table and Parent Sys_ID.
Now the Code opens the whole Service Catalog but now I want that only a specific Catalog Category is opened to show the Catalog Items inside that Category.
Is this possible somehow or not and does someone know if there is a Documentation of all functions of that API ?
Thanks
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2024 11:23 AM
Hello Ruihster,
I have a very similar use case and have found a working solution!
Please find the steps provided below.
1. (Prerequisite) Navigate to Service Portal > Portals and open the Service Workspace Portal record
2. (Prerequisite) Scroll down to the Catalogs Related List, click the Edit button, then select the Catalogs that you would like available to the Workspaces and click Save
3. Navigate to System UI > UI Actions and open the record for your UI action
(In this example I use the Create Request OOB UI Action filtered with Format for Configurable Workspace is True)
4. Configure your Workspace Client Script
Under the Workspace section, there is Workspace Client Script field that is populated OOB like so:
function onClick(g_form) {
var result = g_form.submit('sysverb_ws_save');
if (!result) {
//failed form submission
return;
}
result.then(function() {
var params = {};
params.sysparm_parent_table = "sn_customerservice_case";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item', '-1', params);
});
}
(Option A) You may specify a service catalog to default to by inserting the following line before g_service_catalog.openCatalogItem:
params.catalog_id = "YOUR_CATALOG_SYS_ID";
(Option B) You may specify the category to default to by inserting this instead:
params.catalog_id = "YOUR_CATALOG_SYS_ID&id=sc_category&sys_id=YOUR_CATALOG_CATEGORY_SYS_ID";
The result should look something like this:
function onClick(g_form) {
var result = g_form.submit('sysverb_ws_save');
if (!result) {
//failed form submission
return;
}
result.then(function() {
var params = {};
params.sysparm_parent_table = "sn_customerservice_case";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
params.catalog_id = "YOUR_CATALOG_SYS_ID&id=sc_category&sys_id=YOUR_CATALOG_CATEGORY_SYS_ID";
g_service_catalog.openCatalogItem('sc_cat_item', '-1', params);
});
}
5. Save and test the UI Action directs you to the appropriate Service Catalog and/or Category in the Workspace
I hope this helps!
If my answer helped you in any way mark answer as helpful and correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 05:33 AM
Hi ChrisJohnsten,
I have the same use case and tried your approach. I can see the passed parameter in the URL, ...catalog_id%2FeMY_CATALOG_SYSID%26id%3Dsc_category%26sys_id%3DMY_CATEGORY_SYSID, but still the whole Catalog is displayed in SOW workspace and not the specific Category. Did it really work for you?
Thank you and BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 08:52 AM
Hi BenSB,
Yes, it works for me, I click the Create Request UI Action and it pulls up the appropriate catalog and category. Please see the screenshot provided.
The parameters in the URL should auto-select these items on the page.
I'd recommend making sure that you've got the correct sys_ids. Please try the instructions provided below.
Getting the Catalog sys_id:
1. In the filter navigator, go to: sc_catalog.list
2. Open the appropriate catalog record
3. Right click the form header and click Copy sys_id
Getting the Category sys_id:
1. On the Catalog page in the previous step, scroll down and open the Categories Related List
2. Open the appropriate category record
3. Right click the form header and click Copy sys_id
Let me know if this fixes the issue.
If my answer helped you in any way please mark my answer as helpful and correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 09:31 AM - edited ‎03-27-2024 12:22 AM
Hi ChrisJohnsten,
I am using the "Create Request" UI Action on the incident table and it now works for me in the CSM/FSM Configurable Workspace.
However, in Service Operations Workspace, the UX Form Action "Create request", which uses the same UI action, does not work and opens the entire catalog instead of the category.
For me, one and the same UI action is addressed in both workspaces. Unfortunately, however, it behaves differently. I'm not sure if it's because of the grouping of the Create UI actions in the Service Operations workspace...or something else.
BR