Send an email not linked to a survey with conditions | XM Community
Skip to main content
Solved

Send an email not linked to a survey with conditions

  • July 5, 2023
  • 12 replies
  • 169 views

Forum|alt.badge.img+8

Hi!

 

I need to send an email that is not linked to a survey but an embedded data (it is a date field) of the participant. Is there any workaround i can do for this?

 

Thank you in advance!

Best answer by Deepak

@Erikahuer Sure, you need the code task to compare the "last date" occurred four days or more before the current date if I understand your use case correctly.

Something like this 

function codeTask() {
var lastDate = "~{qde://supplemental.embeddedData.LastDate}";
var currentDate = new Date();
currentDate.setDate(currentDate.getDate() - 4);
var lastDateParts = lastDate.split("/");
var lastDateObj = new Date(lastDateParts[2], lastDateParts[0] - 1, lastDateParts[1]);
if (lastDateObj <= currentDate){
return {
result: "true"
}
}else return {
result: "false"
}
}

You can then use the result value of true as condition before email task, also update last date embedded data from piped text as required. It would look like below:

Hope it helps!

12 replies

InessaG
Level 5 ●●●●●
Forum|alt.badge.img+19
  • Level 5 ●●●●●
  • July 5, 2023

You can perhaps schedule it as a Thank You email if it’s part of a distribution you can easily select in a survey.


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 5, 2023

@InessaG sadly it is not linked to a survey, it is an email that stands alone.


Naman_Savla
QPN Level 4 ●●●●
Forum|alt.badge.img+9
  • QPN Level 4 ●●●●
  • July 6, 2023

@Erikahuer Could you please elaborate more on your query? 


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 6, 2023

Hi @Naman_Savla , sure!


So for example I am bringing contacts by an integration and there is a field there of last date that is configured as MM/DD/YYYY, we need to send to the people that last date was 4 days before an email, but this email would not be linked to any survey. It is just a we miss you type of email.

 


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • July 6, 2023

@Erikahuer 

You can use this event in workflow (Experience ID Change Event (qualtrics.com)). Based on contacts added.

Once you have the date field you need to compare it with current date you can use code task post which you can use email task conditional basis.


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 6, 2023

Hi @Deepak 
This is a great approach!

Would you help me to understand a little bit more the code task as a conditional for the email. I got a little bit lost there.


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • Answer
  • July 6, 2023

@Erikahuer Sure, you need the code task to compare the "last date" occurred four days or more before the current date if I understand your use case correctly.

Something like this 

function codeTask() {
var lastDate = "~{qde://supplemental.embeddedData.LastDate}";
var currentDate = new Date();
currentDate.setDate(currentDate.getDate() - 4);
var lastDateParts = lastDate.split("/");
var lastDateObj = new Date(lastDateParts[2], lastDateParts[0] - 1, lastDateParts[1]);
if (lastDateObj <= currentDate){
return {
result: "true"
}
}else return {
result: "false"
}
}

You can then use the result value of true as condition before email task, also update last date embedded data from piped text as required. It would look like below:

Hope it helps!


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 6, 2023

Thank you so much @Deepak!

I will try this way.


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 7, 2023

Hi @Deepak  i tried but for some reason i get this result when it runs.

 


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • July 7, 2023

@Erikahuer 

The trigger should be experience ID change and not at a specific time, I am guessing that’s the error.

 


Sowrabh1993
QPN Level 5 ●●●●●
Forum|alt.badge.img+15
  • QPN Level 5 ●●●●●
  • July 7, 2023

Hi @Erikahuer ,

 

In case you have the option of running Contact import automation via SFTP, I can suggest a simple option here.

  1. Create a file and drop it on an SFTP. (this would be a contact list file that gets imported into a mailing list)
  2. Setup Contact Import Automation which imports these files daily at a set frequency
  3. Link this import automation to 2 distribution automations
  4. 1st Distribution automation should run immediately and should be connected to a dummy survey and the message that you create should not have the survey link. You can hide the link using this code: <div style=“display:none;”>${surveyLink}<div> This will ensure that the message goes out without the link of the survey.
  5. 2nd automation can be run after 4 days(see below setting) with the actual survey connected to it.

Not sure if this would completely solve the requirement, but could be a workaround.

 


Forum|alt.badge.img+8
  • Author
  • QPN Level 4 ●●●●
  • July 10, 2023

@Deepak Hi, yeah i changes a little the flow and now it is working.

This is how it ended up looking.

 

@Sowrabh1993  sadly i do not have the SFTP automatization, but it is a clever option.

Thank you for the help guys!