Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
UI Action
Client - true
action name - open_item
show update - true ( As per your requirement)
onClick - openItem();
Workspace Form button - true
Format for Configurable Workspace - true
*/

//Workspace client script:
function onClick() {
var result = g_form.submit('open_item');
if (!result) {
return;
}
result.then(function() {
var params = {};
params.sysparm_parent_sys_id = g_form.getUniqueValue();
params.sysparm_shortDescription = g_form.getValue('short_description');
//add params as required, These params can be parsed and used in the record producer.
g_service_catalog.openCatalogItem('sc_cat_item', 'recordproducer_sysid_here', params);
//Use the record producer sys_id in second parameter.
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Catalog Client script on the record producer/catalog item you want to open from ui action
Name - ParseURL
Type - Onload
Applies on catalog item view - true
*/

function onLoad() {


g_form.setValue('task',parseURL('sysparm_parent_sys_id'));
g_form.setValue('description',parseURL('sysparm_description));

function parseURL(paramName) {

var url = decodeURIComponent(top.location.href); //Get the URL and decode it
var workspaceParams = url.split('extra-params/')[1]; //Split off the url on Extra params
var allParams = workspaceParams.split('/'); //The params are split on slashes '/'

//Search for the parameter requested
for (var i=0; i< allParams.length; i++) {
if(allParams[i] == paramName) {
return allParams[i+1];
}
}
}
}
/*
pass the parameter name which was used in the ui action to parse the value here.
Example - parseURL('sysparm_description) as I am passing description value in the params from ui action.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
When we want to open a catalog item with details from current record and map it to the opened catalog form then we can use this code.

This UI Action and catalog client script Redirects you to the record producer or catalog item( based on the sys id provided) and auto-populates the fields from the parent record to the catalog item/record producer variables.

1. UI Action
Client - true
action name - open_item
show update - true ( As per your requirement)
onClick - openItem();
Workspace Form button - true
Format for Configurable Workspace - true

2. Catalog Client script.
Type - Onload
Applies on catalog item view - true
Name - ParseURL

Note : Above UI Action works in Configurable workspace and opens the catalog item/record producer in workspace itself.
Loading