Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

NLWS.xtkWorkflow.PostEvent possible bug or safelinks.protection.outlook.com making multiple requests

David__Garcia
Level 8
Level 8

Hi Experts,

 

After troubleshooting a webapp that was sending multiple commands to start a workflow, I noticed a difference in the following post Events
both work in terms of successfully triggering the workflow, however, NLWS.xtkWorkflow.PostEvent would send the command multiple times, is this a bug?
 
NLWS.xtkWorkflow.PostEvent("WKF_ESG", "signal", "", {variables: {"recipientId":parseInt(ctx.recipient.@id),"prospect":1,}}, false);  
 
xtk.workflow.PostEvent("WKF_ESG", "signal", "", <variables recipientId={parseInt(ctx.recipient.@id)} prospect="1" />, false);

https://docs.adobe.com/content/help/en/campaign-classic/technicalresources/api/p-14.html

I correlated the following two errors also each time the webapp used the NLWS version; which matches the webapp sending the command twice.

 

 

    2021-07-31 00:22:06 JST-310034 Function logonEscalation used by 'Anonymous account' to become 'Web applications agent (webapp)' (context=rvletContext).
    2021-07-31 00:20:47 JST-310034 Function logonEscalation used by 'Anonymous account' to become 'Web applications agent (webapp)' (context=rvletContext).

 

 

**Update**
 
I found the root cause and seems  Outlook safelinks masking our webapp URL which  makes multiple requests to my webapp. perhaps because their protection system first takes the requests and redirects, not sure if this is the case but, has someone experienced something similar?
 
For example the following link, upon click, outlook makes 2 subsequent requests.

 

1 Accepted Solution
David__Garcia
Correct answer by
Level 8
Level 8

x

var rcpObj = nms.recipient.load(ctx.recipient.@id);
var rcpXml = {recipient: {_key: "id", id: rcpObj.id}}

if (!rcpObj.doubleOptin) { 
 
        nms.subscription.Unsubscribe('SVC_DO_CAZ', rcpXml);
        nms.subscription.Unsubscribe('SVC_DO_SCH',  rcpXml);   
      
        rcpObj.doubleOptin=1
        rcpObj.save();
             
          /**********************************/
               
          if (rcpObj.doubleOptin == 1) 
      
			{     
                  
                  if (rcpObj.origin == "ESG") {
                  
                    if (rcpObj.lawfulBasis == 2 || rcpObj.lawfulBasis == 3) {
                      nms.subscription.Subscribe('SVC52',  rcpXml, false);                      
                    }
                                    
                    var goal = sqlSelect("latest,@id:string",
                                         "SELECT MAX(iGoalsId) as xyz FROM CusGoals WHERE biRecipientId='"+parseInt(ctx.recipient.@id)+"' "); //get latest goalId
                    
                    xtk.workflow.PostEvent("WKF_ESG", "signal", "", <variables recipientId={parseInt(ctx.recipient.@id)} prospect="1" goalId={parseInt(goal.latest.@id)} />, false);   //start delivery workflow and send variables                      
                    logInfo("Recipient Verified: "+rcpObj.email+" "+parseInt(goal.latest.@id)+" "+parseInt(ctx.recipient.@id));                                                     
                
                  } else if(rcpObj.origin == "Carbon") {
                    //dosomething
                  }
          
			}
      
          /*********************************/            

} else if (rcpObj.doubleOptin) {
   logInfo("Recipient already optedin: "+rcpObj.email+" "+parseInt(ctx.recipient.@id));
}

My solution was to enhance my double opt-in logic, here is a free snippet in case it may help others with their tasks

View solution in original post

1 Reply
David__Garcia
Correct answer by
Level 8
Level 8

x

var rcpObj = nms.recipient.load(ctx.recipient.@id);
var rcpXml = {recipient: {_key: "id", id: rcpObj.id}}

if (!rcpObj.doubleOptin) { 
 
        nms.subscription.Unsubscribe('SVC_DO_CAZ', rcpXml);
        nms.subscription.Unsubscribe('SVC_DO_SCH',  rcpXml);   
      
        rcpObj.doubleOptin=1
        rcpObj.save();
             
          /**********************************/
               
          if (rcpObj.doubleOptin == 1) 
      
			{     
                  
                  if (rcpObj.origin == "ESG") {
                  
                    if (rcpObj.lawfulBasis == 2 || rcpObj.lawfulBasis == 3) {
                      nms.subscription.Subscribe('SVC52',  rcpXml, false);                      
                    }
                                    
                    var goal = sqlSelect("latest,@id:string",
                                         "SELECT MAX(iGoalsId) as xyz FROM CusGoals WHERE biRecipientId='"+parseInt(ctx.recipient.@id)+"' "); //get latest goalId
                    
                    xtk.workflow.PostEvent("WKF_ESG", "signal", "", <variables recipientId={parseInt(ctx.recipient.@id)} prospect="1" goalId={parseInt(goal.latest.@id)} />, false);   //start delivery workflow and send variables                      
                    logInfo("Recipient Verified: "+rcpObj.email+" "+parseInt(goal.latest.@id)+" "+parseInt(ctx.recipient.@id));                                                     
                
                  } else if(rcpObj.origin == "Carbon") {
                    //dosomething
                  }
          
			}
      
          /*********************************/            

} else if (rcpObj.doubleOptin) {
   logInfo("Recipient already optedin: "+rcpObj.email+" "+parseInt(ctx.recipient.@id));
}

My solution was to enhance my double opt-in logic, here is a free snippet in case it may help others with their tasks

View solution in original post