‎06-25-2015 01:44 PM
I have a custom table that is extended from Task.
I have a UI action that updates a custom field. It works fine if I press the button without changing anything else on the form. However, if I press the button after I've put some text into the WorkNotes field, the record updates twice in the activity log. The first update is the Approval State change and the Work Notes, and the second update contains the Approval State once again.
I have verified that no business rules are running against this table. Why is this happening? I need to ensure that the record is updated only once because I'm triggering notifications on the update.
approveIVT();
function approveIVT() {
current.u_approval_state = 1;
current.update();
action.setRedirectURL(current);
}
Solved! Go to Solution.
‎06-26-2015 01:29 PM
Hi Leslie,
If you enable all debugging and perform the action where you have some text in the work notes, what are the outputs for when you limit to:
a.) Business Rules
b.) Logs
c.) SQL
I am hoping that some information shows up in either of these logs that can shed some light on the situation. I know you said you disabled BRs for the table however in my experience there can be BRs that run from other tables that can sometimes be missed (task, global, etc.).
There could be some BR for instance that is checking on the sys_journal field, that triggers an event when the work_notes change, which then triggers this duplicate update you are seeing.
Best regards,
Brian
‎06-25-2015 03:24 PM
Hello Leslie,
What if you try putting the action.setRedirectURL(current) above the current.update()?
approveIVT();
function approveIVT() {
current.u_approval_state = 1;
action.setRedirectURL(current);
current.update();
}
Best regards,
Brian
‎06-25-2015 04:51 PM
Hi Leslie, some thoughts of things that you could try:
a) try to see if removing the action name Approve_IVT works. I believe you can leave that field blank if you're not relying on it somewhere else.
b) try pulling out the action.setRedirectURL(current); from the function and leaving it after the function call. Something like this:
approveIVT();
action.setRedirectURL(current);
function approveIVT() {
current.u_approval_state = 1;
current.update();
}
c) check if you have a client script that may be setting the value in an onChange or onSubmit
d) try removing the current.update() and see which effects it has.
I hope this is helpful! Blessings!
Thanks,
Berny
‎06-26-2015 12:36 PM
Hi guys, thanks for the suggestions. Unfortunately I have tried everything you mentioned and it still doesn't work.
*I have disabled ALL client scripts, UI policies, and business rules on the table
*When I remove current.update() the record does not update at all.
*When I remove action.setRedirectURL(current) it updates the record but still as a duplicate.
Note the duplicate update only happens when I do something else to the record at the same time, such as when I enter some text in the WorkNotes and then press the Approve button.
The activity log shows the WorkNotes updated once and the Approve updates twice.
Thank you
‎06-26-2015 01:07 PM
Hi guys,
I figured out that it is unrelated to the UI Action itself.
If I go into the form and manually change the ChoiceList from "Pending" to "Approved", enter some text into the WorkNotes and then Save, the duplicate update still happens.
So it is not the custom UI Action. There is something about the table or form that is causing this issue. Any idea? Thanks!