PRE_SAVE_DOCUMENT Event

In this example, we compute the document before the save is going to be executed.

PRE_SAVE_DOCUMENT Event Example 1
events PRE_SAVE_DOCUMENT: {
	context, document ->
	nsfHelp = context.getNSFHelper()
	nsfHelp.computeWithForm(document)
}

In this example, we create a response document to a main document. The main document is defined by providing the parent_id.

PRE_SAVE_DOCUMENT Event Example 2
events PRE_SAVE_DOCUMENT:{
context, document ->
	parentId = context.getRouterVariables().get('parent_id')
	nsfHelp = context.getNSFHelper()
	nsfHelp.makeDocumentAsChild(parentId, document)
	nsfHelp.computeWithForm(document)
}