On Cell edit query

Not applicable

Hi All,

 

From incident list, if the category changes to software and subcategory changes to email then record should not submit.

I have written the On cell edit client script:

JPRamyaPriya_0-1690137449392.png

 

Script include:

JPRamyaPriya_1-1690137509813.png

 

How to pass newValue of subcategory to script include?

Any help is appreciate!!

Thanks in advance!!

 

 

Tony Chatfield1
Kilo Patron

Hi, what are the results of your debugging\testing? what exactly is\is not working?
Evaluating screenshots is not ideal, perhaps you could share your code as plain text.

Not applicable

Thanks Tony!!

what are the results of your debugging\testing? -- In the alert we are getting old value of category

what exactly is\is not working? - if we change category to software in the list and sub category changes to email then record should not submit to server. Script should check is it category is software or not, if yes, then the record should abort.

 

On cell edit Client script:

Field name: Sub category

Script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('incidenttTable');
ga.addParam('sysparm_name', 'tablequery');
ga.addParam('sysparm_syssid', sysIDs);
ga.addParam('sysparm_newvalues', newValue);
ga.getXML(myid);

function myid(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");
alert('ramya' + answer);
if (answer == 't1')
if (newValue == 'email')
alert('anns' + answer);
saveAndClose = false;

}
callback(saveAndClose);
}

 

Script Include:

var incidenttTable = Class.create();
incidenttTable.prototype = Object.extendsObject(AbstractAjaxProcessor, {
 
    tablequery: function() {
        var sysid = this.getParameter('sysparm_syssid');
        //var managername = '';
        var empname = new GlideRecord('incident');
        empname.get(sysid);
        empname.query();
        if (empname.next()) {
gs.addInfoMessage('category' + empname.category);
            var state = empname.category;
        }
        var catgory;
        if (state == 'software')
gs.addInfoMessage('category inside' + empname.category);
            catgory = 't1';
        return catgory;
    }
});
 
Thanks in advance!!

Not applicable

Hi @Community Alums ,

You can acheive this without coding.

1. Create Before Insert/Update BR.(It'll work for list editing too)

2.  Filter conditions : category is software

                                    Subcategory is Email

3. Under actions Tab: select Add message & Abort action.

 

Note: Script includes + OncellEdit scripts are not efficeint together , You can user before BR.

Not applicable

Hi Khasim,

Thanks!!

My lead want me to do with On cell Edit.

 

Any idea?