Save () on data source does not fire querySave / postSave events
My save button is using SSJS with some logic. I want to keep the data source, so I use
document1.save();
The script works, but the querySave / postSave code is not executed.
The only workaround is to use a simple action and divide the button event into blocks for "execute script", "Save document (simple action)" and "execute script" (just return the string "Navigation").
Is it possible to save datasource in SSJS and fire qS / pS events?
+3
source to share
2 answers
try this SSJS code:
var dsName = "document1.DATASOURCE";
var app = facesContext.getApplication();
var ds = app.getVariableResolver().resolveVariable(facesContext, dsName);
ds.save( facesContext, true );
The dsName variable contains the name of your data source, followed by ".DATASOURCE". To use it fe with the current document, you should go to "currentDocument.DATASOURCE".
Hope it helps
Sven
+16
source to share