Hey guys, does anyone know of a way to determine w...
# suitescript
s
Hey guys, does anyone know of a way to determine whether a record is currently open/being accessed by another process? We have function that sets some fields on a sales order, then tries to save the record, which is being triggered several times in quick succession. I'm thinking there might be a way to prevent further access if another process has this record "open". This is causing the infamous rcrd_has_been_changed error.
l
You may try exploring this as suggested by SuiteAnswers: nlapiLookupField(nlapiGetRecordType(), nlapiGetRecordId(), 'lastmodifieddate') ---> ID: 34404
s
Thanks Lea, do you know when the lastmodifieddate gets updated? I'm assuming on successful submission of the record right? My problem is that the second attempt to access the record is happening before the first record submit actually completes.
r
I would suggest creating a workflow that locks the record. Then have a Before Load User Event script that runs on edit to lock the record for other users
l
@SimonC you're right it gets updated upon submission of the record. This is really tricky. @rustyshackles I also thought about the Lock Record action, but that would mean locking the record for everyone right? I don't think there's a context in the workflow that "will only lock the record if someone else is trying to edit it." I could be wrong.