I've created a custom workflow activity that calls an API to get exclusions of recipients.
I delete the relevant records from the temporary activity schema (vars.tableName / vars.targetSchema) but the output transition still shows the previous count that was input to my custom activity. If I check the data the count is different than shown in the workflow canvas.
I've tried xtk.session.write and sql to delete from the target schema. Both work to delete but none update the count.
How can I delete from the temporary schema for the activity and have a correct count on the output transition?
Add this to your code:
vars.description = vars.recCount = sqlGetInt('select count(*) from ' + vars.tableName);
My previous explanation dissapeared - here we go again.
The use case is that several blocking attributes for communication with a recipient resides in different external databases and can at any time change. These need to be checked before sendout of any delivery. The attributes are updated in the ACC database and filtered out from all targeting but since they can change they have to be double checked before sendout (ie in campaign workflows).
A function contacting the databases to get current status of the blocking attributes has been created centrally and an API published to call this function.
A workflow activity has been created which performs the call to the API to validate all recipients of a target. Any recipient that the API disqualifies need to be removed from the target. The workflow activity therefore deletes blocked recipients from the temp target schema.
This works (display target will show the correct records and count) except for the description and recCount of the output result that is not updated. This is what I want to update.
The use case is that several blocking indicators for sending to a recipient resides in external databases. Some of these are imported on a regular base.
The values (if to block or not) can change at anytime and it is by law forbidden to send to these recipients (this is beyong GDPR).
A function that can at any time check all these databases for all the current blocking values. The function is central and a REST API has been published to call to check if a recipient is ok to send to.
On every campaign all recipients need to be checked against this API.
A custom Workflow activity has been created that do the API call to ensure it is easy to create campaign workflows and perform the check. The activity also filters the target based on the result of the API calls, IE it deletes the records in the temp target schema that was returned as blocked from the API.
The resulting output result of the activity only contains a target that is allowed by the external database values.
The description and recCount in the resulting output does however not reflect the actual remaining records - this what I want to update.
Can you describe the use case as to why you are trying to delete records from the temporary schemas? It just seems like a lot of extra work when you could just alter the query or add a split activity to filter off the relevant records.
Additionally when you say the previous count, do you mean on the outbound transition in the workflow or do you mean when previewing the outbound transition?