Hide choice value on list view?

kris29
Tera Contributor

Hi,

How to hide a choice value (Linux) on the list view for a user with non admin access ?

On form I used client script onLoad but it's not working on onCellEdit.

var adminUser= g_user.hasRole('admin');

if (!adminUser){
     g_form.removeOption('operation_system', 'Linux');
}
1 ACCEPTED SOLUTION

Shakeel Shaik
Giga Sage
Giga Sage

Hi kris,

 

Create OnCellEdit Client Script:

select field - operation_system

script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;

	//In Place of "10" add your Linux value

	
    if ((newValue == '10') && (g_user.hasRole('admin'))) {
        saveAndClose = true;

    } else {
        alert('Only admin can select this choice');
        saveAndClose = false;
    }

    callback(saveAndClose);
}

If my above response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

View solution in original post

8 REPLIES 8

Shakeel Shaik
Giga Sage
Giga Sage

you can't remove the choice.

you can restrict the user to select particular choice through onCellEdit

Thanks,
Shakeel Shaik 🙂

Create OnCellEdit Client Script:

select field - operation_system

script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;

	//In Place of "10" add your Linux value

	
    if ((newValue == '10') && (g_user.hasRole('admin'))) {
        saveAndClose = true;

    } else {
        saveAndClose = false;
    }

    callback(saveAndClose);
}

If my above response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

Shakeel Shaik
Giga Sage
Giga Sage

Hi kris,

 

Create OnCellEdit Client Script:

select field - operation_system

script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;

	//In Place of "10" add your Linux value

	
    if ((newValue == '10') && (g_user.hasRole('admin'))) {
        saveAndClose = true;

    } else {
        alert('Only admin can select this choice');
        saveAndClose = false;
    }

    callback(saveAndClose);
}

If my above response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

Hi Kris,

If my above response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂