Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Field validation in list view

aahitha2
Mega Expert

Hi Team,

There is an string field "X", I need to restrict the updation of negative values from table list view.

I have "ONSUBMIT" client script which is restricting from form level and same restriction is not applying for list view.

How can I achieve this?

Thanks,

Aahitha

 

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

Hi @aahitha 

This may help you

Write OnCell edit client script on your  'X' field

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;
    //Type appropriate comment here, and begin script below
    if (newValue <= 0) {
        alert('Not poosible');
        saveAndClose = false;
    }
    callback(saveAndClose);
}

 

Thanks

Murthy

Thanks,
Murthy

View solution in original post

6 REPLIES 6

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

If you need to validate on list view too, just do it via a before Insert/update BR.

-Anurag

-Anurag

Hi Anurag,

I have tried using before Insert/update BR, but not working.

 

Thanks,

Aahita

 

Can you show the BR you have written?

-Anurag

Murthy Ch
Giga Sage

Hi @aahitha 

This may help you

Write OnCell edit client script on your  'X' field

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;
    //Type appropriate comment here, and begin script below
    if (newValue <= 0) {
        alert('Not poosible');
        saveAndClose = false;
    }
    callback(saveAndClose);
}

 

Thanks

Murthy

Thanks,
Murthy