Approval State Reverts to "No Longer Required" After Setting to "Requested" via UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2025 01:05 AM
Hi everyone,
I'm working on a custom Expense Management application in ServiceNow, where I'm using a custom table called x_merl4_expense_ma_line_of_items to store expense line items. For approvals, I'm using the standard sysapproval_approver table. Each approval record is linked to a line item through the sysapproval reference field.
I've added a UI Action directly on the sysapproval_approver table. When clicked, it first checks if the manager's remarks field (u_manager_remarks) is filled, and then updates the related line item's state to "Submit for Review" (state = 3). After that, it sets the approval record's state to "requested" and updates it. The script runs fine without any errors and updates both the line item and approval state correctly.
However, right after the update, the approval record's state automatically changes to "No Longer Required". I've confirmed that the parent Line Item is active and not closed or rejected. There's no business rule canceling the approval either.
I'm trying to retain the approval state as "requested" after the action, but it seems like some platform logic or flow is overriding it. Has anyone faced a similar issue or knows how to prevent the system from auto-updating the state to "No Longer Required"?
Any suggestions would be really appreciated.
Thanks,
Varinda Girdher
Varinda Girdher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2025 01:36 AM
You need to check on (work)flows on the sysapproval_approver table. Some logic is in the way, but we can't see in your instance to assist on that. What exactly is the UI action doing? Do you have logic on the target table that is conflicting (like moving a state and the approval table not accepting that is 'remain in approval')?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2025 02:06 AM
Thanks Mark - yes, I'll check any Flow or BR logic that may be conflicting. I'm also triggering the UI Action from sysapproval_approver, which updates both the approval record (state to requested) and the parent line item (state to 'Submit for Review'). I'll look into whether that state change on the parent is triggering some system cancellation of the approval.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2025 02:19 AM
Thanks Mark - yes, I'll check any Flow or BR logic that may be conflicting. I'm also triggering the UI Action from sysapproval_approver, which updates both the approval record (state to requested) and the parent line item (state to 'Submit for Review').
The reason I need the approval state to stay as 'requested' is because when the manager clicks "Submit for Review", the Line of Item state is set to 'Return for Review'. On the ESC portal, the user can then reopen the form, upload the bill receipt, fill out remaining fields, and save the record.
During that time, the approval state should remain 'requested' so that the manager can later review everything and take action - either approve, reject, or cancel based on the completed information. That's why I want to avoid the system automatically changing the state to 'No Longer Required'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2025 02:34 AM
Hi Vrinda,
I have a few suggestions. Creating the UI action directly on the out-of-the-box (OOB) approver table is not the best practice. For custom solutions, it's better to find a more appropriate place for the action. Additionally, changing the state to "requested" on the approval table via script is also not ideal. Validations for the remarks field and others could have been easily handled using flow, and the "Ask for approval" OOB flow action could have been utilized. This approach would simplify debugging, as it is clearer in the flow designer.
That being said, I recommend using the script debugger to identify which other business rule is updating the field to "No longer required." You can try using setWorkflow(false); to stop other flows and see if the update stops. However, I suggest revising the solution and adopting best coding practices to avoid issues in production later.