What is the best way of identifying that a user ca...
# suitescript
w
What is the best way of identifying that a user can/cannot edit a transaction in before load? On a transaction that is in a locked period, and the edit button is not shown:
Copy code
newRecord.isReadOnly === false
form.getButton('edit').isDisabled and .isHidden === false
d
is it not editable because the period is Locked? if yes in BL we can perform a search (or Lookup) on periods to find if its locked,
w
true, but it could be non-editable for other reasons. Like that the role doesn't have access to edit the record type in question. Netsuite already knows all of this, I would imagine that they could expose that if they want.
Or locked by workflow
s
Then we can use runtime module to check whether the user has permission like edit view using getPermisssion API from runtime module
if its locked by workfow, may be a search on the same record, by adding few conditions like workflow state ( which state the record is in currently) Not sure on this search ( by adding some workflow based conditions)
c
Thinking out of the box, could you do a submitfields on a checkbox on the record in your beforeload& see if it succeeds? (though might mess things up with a "record was changed" error)
though if it does work, you could then redirect back to the same URL with a &validatedsave=T appended & check for it, then not do the submitfields the 2nd time
that's enough hacky suggestions for one day 🙂
😆 1