Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 03:50 AM
Here are a couple of approaches from mine that you can consider to auto-populate fields when opening the com.glideapp.servicecatalog_cat_item_view UI page.
1. Define an OnLoad client script within the catalog item. Then retrieve the URI and extract the record sys_id to set the variable value accordingly
function onLoad() {
var uri = top.location.href;
var recordId = '';
if(uri.indexOf('demand.do') >= 0){ //replace the table name
var indexSysId = uri.indexOf('sys_id=') + 7;
recordId = uri.substring(indexSysId, indexSysId+32);
}
if(recordId !== ''){
g_form.setValue('ticket', recordId); //your ticket reference catalog variable
}
}
2. We customize the UI Page. Clone the UI page and modify it as follows:
HTML
<input type="hidden" id="task_sys_id" name="task_sys_id" value="${sysparm_task_id}"/>
Client Script
addLoadEvent(function(){
var taskId = $('task_sys_id').value;
g_form.setValue('variables.task', taskId);
});
UI Action
//call your customized UI page here
dialog.addParm('sysparm_task_id', g_form.getUniqueValue());
Cheers,
Tai Vu