Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Difference between nuActionSave and the Save in the action bar Topic is solved

Questions related to using nuBuilder Forte.
yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

Hello,

I initially believed that nuActionSave() was equivalent to clicking the save button in the action bar. However, its behavior appears to be different, particularly when it comes to retrieving the RecordId() afterward.

Case 1: If I save manually using the action bar and then call RecordId(), I correctly get the ID of the saved record.

Case 2: If I trigger nuActionSave() from a custom button and then try to retrieve the record ID, it returns nothing.

Could you please explain why this difference occurs? Also, what would be the proper way to retrieve the saved record’s ID after using nuActionSave()?

Thank you,
Yves
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Difference between nuActionSave and the Save in the action bar

Unread post by kev1n »

Hi,

The record ID is shown for me:

Code: Select all

nuAddActionButton(
  'Run', 
  'Save Test', 
  'nuSaveAction()', 
).css('color','green');


function nuAfterSave() {
  alert('Record ID: ' + nuRecordId());
}

yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Re: Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

Hello Kev1n,

My nuSaveAction(true) is on a custom button in the edit form—not in the Action Bar.
When the save runs from that button, nuAfterSave() doesn’t fire as it fires with nuSaveAction() as opposed to nuSaveAction(true).
I use the true option as I need to close the popup at that moment.
Maybe just use nuSaveAction() without the true option. Is there a way to close the popup with another nubuilder option or do I have to use a javascript option like window.close()

Thanks again for your help.
Best regards,

Yves
Last edited by yvesf on Mon Aug 11, 2025 7:55 am, edited 2 times in total.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Difference between nuActionSave and the Save in the action bar

Unread post by kev1n »

I’m not seeing this issue when using a button with an onclick event calling nuSaveAction();.

And in Custom Code:

Code: Select all

function nuAfterSave() {
   alert('nuAfterSave triggered!');
}
It’s possible that some other code or settings in your form or setup are preventing the event from triggering.
yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Re: Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

nuSaveAction(true) doesn't fire nuAfterSave() after additionnal tests as opposed to nuSaveAction().
yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Re: Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

Workaround :

Code: Select all

nuSaveAction();// to fire the nuAfterSave() function
nuSaveAction(true); // to close the popup
weird but very efficient

Yves
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Difference between nuActionSave and the Save in the action bar

Unread post by kev1n »

In nuUpdateData(), the form is closed if true is passed to nuSaveAction().

If you place
nuProcessAfterSave();
after the line nuFORM.edited = false;, then nuAfterSave() will also be executed.
yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Re: Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

Just made the change without any impact
nuajax.js
. Maybe I have to refresh smthg

Yves
You do not have the required permissions to view the files attached to this post.
Last edited by yvesf on Mon Aug 11, 2025 10:11 am, edited 1 time in total.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Difference between nuActionSave and the Save in the action bar

Unread post by kev1n »

Did you log out, then log back in to nuBuilder?
yvesf
Posts: 338
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Re: Difference between nuActionSave and the Save in the action bar

Unread post by yvesf »

yes but no real result. I cannot restart the web server as I am hosted by cybermania
Post Reply