Created NEW SCTASK Custom Button in sc_task table, once clicked getting No records selected.

arun2324
Tera Contributor

Created NEW SCTASK Custom Button in sc_task table, once clicked getting No records selected. I don't want to select any existing record & I don't want to use List Control NEW button as there are limitations, Alert & Code snippet attached Please help me.

 

                          in g_list.action("current ui action sys_id", "onclick function name") mentioning, Please provide me complete solution to this.

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

g_list is used to act on a list of selected records, so don't use that.  Base your script on any of the existing UI Actions named 'New' that are on Related Lists:

// get the sysID of the parent software model from the URL
var record = new GlideRecord('cmdb_software_product_model');
record.get(RP.getParameterValue('sysparm_collectionID'));

// get product reference if SAMS is enabled
var productStr;
if (GlidePluginManager.isActive('com.snc.sams')) {
    productStr = 'norm_product=' + record.getValue('product');
} else {
    productStr = 'product_name=' + record.getValue('name');
}

var parmStr = productStr +
    '^publisher=' + record.getValue('manufacturer') +
    '^norm_version=' + record.getValue('version') +
    '^norm_edition=' + record.getValue('edition') +
	'^source=internal' +
	'^lifecycle_type=internal';

action.setRedirectURL('sam_custom_sw_product_lifecycle.do?sys_id=-1&sysparm_query=' + parmStr);
action.setNoPop(true);