Lock Record w/ SuiteScript
Is there a way to lock records with SuiteScript like you can with a workflow?
Record locking is not supported in suitescript. You can try creating a workflow instead. You can try using N/workflow to trigger workflows if you really wanted to be suitescript driven.

Got it. Thanks!
I think I like this approach better than my own
No. You have 2 options really
- Conditionally lock your record using a workflow but drive the logic using suitescript (i.e. checkbox drives workflow and is set by suitescript)
- Check every field updated in a UE using the newRecord object and comparing it with the oldRecord value.If you only care about a few values not changing this is maybe a solution. Keep in mind this will be hard to use for all contexts as xedits and csv’s that run without scripts enabled would easily get past this

Ok. So it sounds like there is no blanket action to lock the whole record like a workflow, which is the conclusion I came to. I wanted to stay in SuiteScript for this solution, but it might be worth just making a quick workflow for this part. Thanks!