Right this is bugging me. ```if (userRole !== 1061...
# suitescript
k
Right this is bugging me.
Copy code
if (userRole !== 1061 || userRole !== 3 || userRole !== 1060 || userRole !== 1065) {
                        var labelrequiredField = form.getField({id: 'custitem_label_required'});
                        labelrequiredField.updateDisplayType({displayType: serverWidget.FieldDisplayType.HIDDEN});
                    }
e
Right just to add a bit here, you would need to change these to
&&
instead of
||
. With
||
, when you are logged in as, say, Admin (3), then your
userRole
IS NOT
1061
, so the
if
returns true and the field gets hidden. That said, I much prefer the approach @lleclerc_zlab gave as it is so much more concise. If/when we can use ES6, then we'll get the
contains
method as well which will be even better.
k
Thanks Eric. Still trying to get my head around || or &&
But yes the way is much better and will be used going forward.
e
[Warning, there's MATH ahead] If you're really interested in boosting your Boolean logic skills, Truth Tables (https://daedtech.com/practical-math-for-programmers-truth-tables-and-boolean-basics/) and Karnaugh Maps (https://en.wikipedia.org/wiki/Karnaugh_map) are great learning tools