UI Action for Agent Workspace - executing both Client and Server Side code in one UI action

Community Alums
Not applicable

Hi All,
THE MOTO IS TO  open a catalog and for that catalog need to submit the request.

 

Please find my Ui action details and code below:

UI action name: Create ICMS Ticket

Active: true

client: true

Onclick: onClickIcms()();

Workspace Form button: true

HemantAggarwal_0-1726746920369.png

 


Workspace Client Script//I have wrote the script here as I was not able to execute in on workspace when written in Script section too

function onClickIcms() {
var url = "/" + "sp?id=sc_category&sys_id=354d31471b774a9058b4744a9b4bcbaf&catalog_id=2d8cb1071b774a9058b4744a9b4bcb19&spa=1";
gsftSubmit(null, g_form.getFormElement(), 'create_icms_ticket');
top.window.open(url, '_blank');
}
if (typeof window == 'undefined') case_map();

function case_map() {
var getCase = current.sys_id;
var session = gs.getSession();
session.putClientData('caseID', getCase);
action.setRedirectURL(current);
}

Kindly suggest on how can we get this working.

 

Thanks in advance.


 




1 ACCEPTED SOLUTION
2 REPLIES 2

Community Alums
Not applicable

HemantAggarwal_0-1726749824198.png

with this script i am jumping into this page not that portal page 
// 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 = "2d8cb1071b774a9058b4744a9b4bcb19&id=sc_category&sys_id=354d31471b774a9058b4744a9b4bcbaf";
//      params.catalog_id = "2d8cb1071b774a9058b4744a9b4bcb19";
//      g_service_catalog.openCatalogItem('sc_cat_item', '-1', params);
       
//  });
// }