Expand my Community achievements bar.

Personalizing error notification using values from operation schema

Avatar

Level 2

Hello Team,

 

 

Is it possible to set values from campaign to the variables in a workflow notification template.

 

I am trying to generate a notification to workflow supervisor with campaign name when a campaign workflow fails.

 

Thank you.

 

6 Replies

Avatar

Community Advisor

Hello @mpalaves 

 

You can get the campaign name in workflow with this code.

 

 var q = xtk.queryDef.create(
  <queryDef schema="xtk:workflow" operation="get">
    <select>
      <node expr="[operation/@label]" alias="@label/>    
    </select>
    <where>     
        <condition expr={"@id ="+instance.id}  /> 
    </where>
      
  </queryDef>
);
var workflow= q.ExecuteQuery();
logInfo("Operation Name is :"+workflow.@label);

     Manoj
     Find me on LinkedIn

Avatar

Level 2

Thank you @_Manoj_Kumar_  for your reply.

I am able to get the campaign name but unable to pass it to the workflow error notification template. How can I pass this extracted value to the workflow notification that is sent to the supervisors when the workflow fails.

 

Regards,

Avatar

Community Advisor

@mpalaves 

 

after this code Add this line.

 

instance.vars.campaignName=workflow.@label

Then open the delivery and in advance tab for delivery add this code.

 

delivery.variables._var[0].stringValue=instance.vars.campaignName;

Now open the delivery go to properties and under variables tab. Create a new variable with data type as string and name it campaignName;

 

Now in your delivery HTML you can use this code to print the campaign Name

<%= variables.campaignName %>

 


     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hello @_Manoj_Kumar_ 

 

Excuse me if my request was not clear. I am still learning the tool. I am referring to use the value in a error notification template. I do not have a delivery task in the workflow to notify the workflow supervisors. 

 

I have customized the technical delivery template with the campaign name variable. But unable to assign the value to it.

 

mpalaves_0-1633109671254.png

 

Avatar

Employee Advisor

HI There,

 

Unless I am mistaken on the request but the Alert activity allows you to get the Workflow and Campaign information via the editor itself. See below

denisb91363072_0-1633618427352.png

Hope this helps,

Thanks

Denis

Avatar

Community Advisor

Hi, 

When you use supervisor notification as alert there is a link at the end which have all the details of that workflow which failed because of some error and also contains Campaign link and campaign label . If you check the source in HTML , it's using workflow.jssp 

 

<%@ include option='NmsServer_IntranetURL' %>/xtk/workflow.jssp?id=<%= dataSource.workflowId %>

 

kapilKochar_0-1634641844044.png

 

kapilKochar_1-1634641932560.png