script to check user against field

jameseverso
Tera Contributor

Excuse my likely incorrect terminology... I haven't looked at JS in years. I'm trying to lock down asset records so only the assigned property custodian can edit (with the exception of the Comments field which I want to remain writable by anyone).

I know the getUserID() method will call the sys_id of the current User and I can check that against the sys_id of the alm_asset.custodian field and return TRUE if they match.

If that all sounds feasible, what's the actual script? Or, even better, is there a non-script solution for this?

6 REPLIES 6

Did you also check on existing ACL's? If there are any in there that allow for everyone to write, you need to inactivate those as well.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Confirm the record you are testing is actually on the same table as the ACL.  I used alm_asset in my example, but maybe it's alm_hardware...  You can see the table name in the URL, or right-click on the header and choose Configure > Table.  Also confirm that 'custodian' is the correct field name, and that's it's actually on that table, not on the form dot-walked from a related field.