It comes handy when you want to send notifications to recipients that are to be computed dynamically based on the data. E.g. send a notification to all staff of order's business unit.
Can be also used to generate senders as well.
- Insert a new notification contact type into a database
In our example we are going to extract a customer email from a booking (rental transaction). So this type of contact can be used in many notifications which involves that booking – e.g. various state changes (new, reservation expired, has been closed, etc.)
If you have a multi-lingual application, you can also add translations of the newly created contact type by inserting the records into
GetNotificationContactsWorkflow to handle out new contact type
The workflow is called from within WorkQueue notification subsystem.
The picture shows the target state of workflow. So that's it. The next steps will describe how to achive this result.
- Create a new data constant with an Id of your new notification data type
Data > Constants > YouPackageName > New > Data Constant
- Create an XPath rule to identify your contact type
Business Logic > Rules > YourPackageName > New > Start Rule
This rule we are going to use in the step of workflow in order to identify and process only notifications with our notification contact type selected.
GetNotificationContactworkflow create a special step for processing our contact type.
GetNotificationContact, right click and select New > Block (Transaction)
Create a workflow step/s with actual transformation (creation of a new AsapNotificationContact data structure)
GetNotificationContacts has the following context stores:
A data structure with a list of found contacts. This context store is a return one and it has to be filled with contacts.
|asapNotificationChannelTypeId||Input||Email/Sms etc. (input)|
|context||Input||Data from a data structure defined in our WorkQueue class as a NotificationStructure. If not defined, the context will contain the "raw" data of the WorkQueueEntry.|
|value||Input||A value passed from Notification Senders/Notification Recipients tab on the Work Queue screen. It is an additional control value that can be added by a user in the Work Queue notification configuration screen.|
|workQueueNotificationContactTypeId||Input||A type of notification contact. We already used this value for checking contact type in step 5.|
The transformation has to have a target context store set to
AsapNotificationContactData. We can create the transformation step by rigth-clicking on
AsapNotificationContactData contextstore and choose Action > New Transform Task.Then we have to set a Data parameter of that transformation to Context so we have set the input for the transformation.
Now move the newly created transformation task under block task with the
Finally create a transformation that will produce contact data simillary as in the following example.
AsapNotificationContact entity Description
|ContactIdentification||x||Identification of a contact. Email in case of e-mail notification channel, phone number in case of SMS channel, etc.|
|Name||Name of contact (e.g. FirstName and Name, or just Name).|
|LanguageTagIETF||Language tag, e.g. 'en-US' or 'de-DE'.|
|refSalutationId||Contact salutation identifier (Guid). Useful in a multilingual application.|
|Salutation||Contact salutation (string).|