We have a requirement where we need to insert/update/remove XDP Forms metadata to Data Base table when the form is published/unpublished. To meet the same requirement I'm doing following.
1. Create Workflow Launcher with event Types 'Node Created' & 'Node Modified' and configured my custom workflow to be trigger upon node create/modify.
2. Custom workflow has the logic to insert /update data in Database table. (Custom workflow process has logic to read XDP form metadata from jcr and update the same in the DB table)
As a result, forms metadata is inserted/updated successfully in DB table whenever the form is published.
Note: We have configured launcher in AEM publish instance so that the forms metadata will be inserted/udpated whenever the XDP form is uploaded/updated.
But the challenge is, we need to remove XDP metadata information from the DB table whenever the form is unpublished as well..
For this, I've tried to create Node Removed event type in the launcher and triggering the workflow but in the workflow process, I'm getting only payload but can't read metadata of the form as the node got removed already from jcr when the form is unpublished. So I'm not able to remove the data from DB in the case unpublish.
Will that be different to do it in author. Because in author, even if you deactivate a form, it will be still present in the repository. Is there any specific metadata which will be present only in publish and not in author ?
Yes Veena, we will be having same content in author as well. The reason why we configured Launcher event on Publisher is, we need to insert/update data on DB only when the form published.
To achieve the requirement, We can also trigger the custom workflow on Author instance when the form is unpublished/deactivated. But the issue is, we have only three types of event types in Launcher (ie. Created, Modified, Removed). So how can we trigger workflow when the user unpublishes the form on author ?
FYI, we are setting OOTB Off Time in Forms properties to unpublish forms.
I have not worked with AEM forms. But a basic question, when you say "we need to insert/update data on DB only when the form published.", Doesn't it the normal page activation kind of thing ? If so, won't it set ReplicationAction as active in author ? This way you can trigger the insert/update from author itself right ?