This workflow recursively fetches all active campaigns, compares their Deadline, and takes action as apprioriate.
7 days pre-due, call sub-workflow
3 days pre-due, call sub-workflow
due date, call sub workflow
7 days past-due, close the campaign and REVOKE any undecided access DevDays2025-2-IterateCampaigns.json (10.5 KB)
This workflow gets called per-campaign, to recursively iterate over CERTIFICATIONS that belong to the campaign that triggered the workflow
Steps taken:
7 days pre-due: email the reviewer
3 days pre-due: email the reviewer and their manager
due date: re-assign the certification to the reviewers manager (if present) DevDays2025-3-IterateCertifications.json (11.4 KB)
I would like to compare the Time stamp only on 4th day past due date (like only duedate +4 day, I don’t want to check duedate+1, duedate+2, duedate+3, duedate+4 days)
I was able to create same workflow and made some changes like not having the revoke certification.
Workflow works great i am able to see the emails as well.
I am getting one problem here my observations are,
when I have more than 100 certification in campaign, it run forever in loop step.
—–@@ Loop step input is –
{
“context.$”: “”,
“input”: [
{
“campaign”: {…etc
—–@@ Loop step output is {
“context”: null,
“definitions”: {
“start”: “Compare Strings 1”,
“steps”: {
“Compare Strings 1”: {
“actionId”: “sp:compare-strings”,
“choiceList”: [
{
“comparator”: “StringEquals”,
“nextStep”:
When i have less than 100 certifications in campaigns it run sucess. Same loop inut as i mentioned ablove and
Lop out put looks like this..
{
“loopOutput”: {
“failureItems”:
“successfulItems”: [
{
“266af576-b4a2-46c-1”: “019551aa687f4ab”,
“compareStrings1”: {..etc
I also observed when i removed subject in one of the email template inside the loop it works with more or less than 100 certifications..
After loop this is my compare string $.hTTPRequest1.body.length().
In side loop i have three email templates, I also added some Templating Context same behavior with or with out Templating Context.
any idea what issue causing my loop step runs for ever and not trigers any email when i have more than 100 certifications.
I have this question :
After loop can i compare like this: $.hTTPRequest1.body.length() is greater than or Equal to 100.
If less than 100 end , if True i am calling http with request body {“campaignId”:“{{$.trigger.campaignId}}”,“pagination”:“{{$.trigger.pagination}}A”}
Thank you for creating this for the broader community and for providing both the instructional video and templates!
I downloaded your templates and followed the instructions step-by-step.
I wanted to note a couple minor updates I made to the “DevDays2025-3-IterateCertifications.json” template to get it to function correctly in my tenant.
The filter string in the GET Certifications call seems to be case sensitive (line 63).
“filters”: “campaign.id eq \”{{$.trigger.campaignId}}\" and completed eq false",
Update “variableA” in Compare Timestamps 3 (line 163 for me) from “$.loop.loopInput.deadline” to “$.loop.loopInput.due”
Hope this can help anyone downloading the templates to implement the workflows.
Thank you for this great template. Should not Recurse HTTP in certifications workflow be sending CampaignId along with pagination? Otherwise, it will fail in verify data type 1 step since it does not see campaignId from self called step.
Hello Stephen, thank you very much for the workflow demo. I tried duplicating your workflow in our sandbox tenant and tested, but unfortunately met with these errors for the Loop output in the Certifcations workflow (see attached file)
FYI my certifications workflow is a short version of yours: there’s only 1 case where due date is before 7 days in the future, then automatically reassign to manager.
hey @lanphuongmai
that looks like youre getting a 404 on the httpRequest card.
take a loop at either the execution history > download JSON, or the new SEARCH BASED workflow execution history
and try to see what URL its attempting to call.
one guess - if youre trying to call a parent steps value from outside the loop, within the loop, youre going to have a bad time - you need loop-internal variables to be part of either the loopInput or loop context to reference them internally.
Hi Stephen,
Could you confirm that your example workflows are working successfully for the use case of reassigning to manager? Could you check if there’s any error or anything missing with the ReassignToManager - HTTP Request in CERTIFICATIONS workflow?
I’ve retried multiple time, also duplicated exactly your workflow json, and I confirm the flow sending emails when due in 3days or 7days both work fine, but the flow automatic reassign certification to the reviewer’s manager still have the exact same error below:
Example:
*“errorMessage”: “task failed: activity error (type: sp:external:http:v2, scheduledEventID: 55, startedEventID: 56, identity: 1@sp-workflow-worker-stg-ca-central-1-6b46884678-6pk6s@sp-workflow-engine): request failed (type: HTTP Response Returned a Client Error, retryable: false): request failed: 404 - 404 Not Found - {“detailCode”:“404 Not found”,“trackingId”:“74de8b3efda042a3a2c20bb8b22b0f05”,“messages”:[{“locale”:“und”,“localeOrigin”:“REQUEST”,“text”:“The server did not find a current representation for the target resource.”},{“locale”:“en-US”,“localeOrigin”:“DEFAULT”,“text”:“The server did not find a current representation for the target resource.”}],“causes”:[]} (type: WorkflowFailure, retryable: false): task failed: activity error (type: sp:external:http:v2, scheduledEventID: 55, startedEventID: 56, identity: 1@sp-workflow-worker-stg-ca-central-1-6b46884678-6pk6s@sp-workflow-engine): request failed (type: HTTP Response Returned a Client Error, retryable: false): request failed: 404 - 404 Not Found - {“detailCode”:“404 Not found”,“trackingId”:“74de8b3efda042a3a2c20bb8b22b0f05”,“messages”:[{“locale”:“und”,“localeOrigin”:“REQUEST”,“text”:“The server did not find a current representation for the target resource.”},{“locale”:“en-US”,“localeOrigin”:“DEFAULT”,“text”:“The server did not find a current representation for the target resource.”}],“causes”:[]}”
*
I’ve attached the execution result json of my CERTIFICATIONS workflow (credentials hidden)
ahhhh i see it, i must have missed that.
okay so:
within the loop, on the CERTIFICATIONS api:
the loop itself doesnt have access to the $.trigger fields.
changes required:
update the LOOP so that the CONTEXT on the loop is $.trigger.campaignId
on the reassignCertifications step, inside the loop, reference it as $.loop.context (and not $.trigger. […])
the LOOP doesnt have access to the trigger, it only has access to the loop items and context you have defined.