Tagging for customDashBoard

Hey we are trying to track the a request in the dialog --there are two service call inside the dialog --the outcome could be either success / failure.

we are declaring a tag at the start in script[1] node
as tags.addSessionLevelTag(“idCardSessionTag”,“Initiated”);

then I’ve a logic where script[2] where I’m updating the tag with following logic

var DT=Math.floor(Math.random() * 2)
var SVC=Math.floor(Math.random() * 2)
// koreDebugger.log("Datatable "+DT)
// koreDebugger.log("SVC "+SVC)

// 1:0 success:failure

if(DT===1){
tags.addMessageLevelTag(“idCardMsgTag”,“DTSuccess”);
}
else
{
tags.addMessageLevelTag(“idCardMsgTag”,“DTFailure”);
}

if(SVC===1)
{
tags.addMessageLevelTag(“idCardMsgTag”,“SVCSuccess”);

koreDebugger.log("idCardMsgTag—SVC–success "+SVC)
}
else
{
tags.addMessageLevelTag(“idCardMsgTag”,“SVCFailure”);

koreDebugger.log("idCardMsgTag—SVC–failure "+SVC)
}

var dtRes= DT ? “success”:“failure”;
var svcRes= SVC ? “success”:“failure”;
context.message="the response from DT service is “+dtRes+”\n The response from the SVC service "+svcRes;

Logic: SVC if condition should is executed at the end should irrespective of DT if condition.

Problem: the final value of the message tag should be SVCFailure/SVCSuccess. But when we check the custom dashboard we see the DTSuccess/DTFailure.

Prove:

comment : please tell what is going wrong here the logic looks clean.