How in a suitescript to query the "version" field ...
# ask-stanley-ai
a
How in a suitescript to query the "version" field of a transaction record, so the script can tell if the record has been modified while the user has been editing it? Or is there another way to do this? I'm trying to warn the user as soon as the record they're editing gets changed by something else before they click the save button, instead of them losing all their changes to a "Record has been changed" error when they try to save those changes. I'm using the version field because it increments every time the record gets saved, even if no changes were made. However, it doesn't seem to be available as a search column, only as a field when the whole record gets loaded. I don't want to load the whole record just to check one field.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that the
version
field of a transaction record is not directly accessible via SuiteScript. However, one of the users suggested a workaround by running a SuiteQL query to get the version number from the transaction history. Here is the suggested query:
Copy code
sql
SELECT version FROM transactionhistory WHERE transaction = 'xxx'
Replace 'xxx' with the ID of the transaction record you are interested in. Please note that this approach might not be the most efficient one, especially if you have a large number of transactions. It's also important to note that this method might not provide real-time data, as the transaction history might not be updated immediately after a transaction is saved. As for checking if a record is being edited by another user, it seems there is no direct way to do this via SuiteScript or workflows. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.892944336
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834106445
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828857422
Please provide your feedback on this answer.