trigger re-approval only when the amount changes
# ask-stanley-ai
s
trigger re-approval only when the amount changes
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To trigger re-approval only when the amount changes, you can use a combination of SuiteScript and SuiteFlow. Here's a general approach: 1. SuiteScript: You can use a User Event script to capture the old total amount of the Purchase Order (PO) before it's edited. This can be done in the
beforeSubmit
context. 2. SuiteFlow: Create a workflow that triggers on record submit. In this workflow, create a state that checks if the old total amount (captured in step 1) is not equal to the new total amount. If they are not equal, change the approval status back to 'Pending Approval'. Here's a sample code snippet for the SuiteScript part:
Copy code
javascript
function beforeSubmit(context) {
    if (context.type === context.UserEventType.EDIT) {
        var oldRecord = context.oldRecord;
        var oldTotal = oldRecord.getValue('total');
        // Store this oldTotal in a custom field or some other place where it can be accessed by the workflow
    }
}
For the SuiteFlow part, you would need to create a workflow with a state that checks if the old total amount is not equal to the new total amount. If they are not equal, it should change the approval status back to 'Pending Approval'. Please note that this is a general approach and might need to be adjusted based on your specific business requirements and NetSuite setup.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826309741
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805289209
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804889858
Please provide your feedback on this answer.