
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:01 PM
Hi,
I am trying to Write an OnLoad Client script on the Task table,
I want to get the Catalog Item sys_id when its Related Task form is Loaded Is it possible?
Thanks
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:04 PM
Here is the solution
1. Create a Display business rule against sc_task Table with the script as
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
g_scratchpad.catItemSysId = current.request_item.cat_item;
})(current, previous);
2 Now create a OnLoad Client script
function onLoad() {
//Type appropriate comment here, and begin script below
alert(g_scratchpad.catItemSysId); //This will give catalog item SysId
}
- Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:02 PM
Hi Gowtham,
You can get the catalog item sys_id via CS + GlideAjax approach or the other approach is to do via Display BR + CS. Solution shared below.
Reference:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:04 PM
Here is the solution
1. Create a Display business rule against sc_task Table with the script as
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
g_scratchpad.catItemSysId = current.request_item.cat_item;
})(current, previous);
2 Now create a OnLoad Client script
function onLoad() {
//Type appropriate comment here, and begin script below
alert(g_scratchpad.catItemSysId); //This will give catalog item SysId
}
- Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:25 PM
Thank you Pradeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2020 11:26 PM
You are very welcome Gowtham.