How to manage a JS code task with an embedded data that doesn't exist | XM Community
Skip to main content
Question

How to manage a JS code task with an embedded data that doesn't exist

  • June 26, 2023
  • 2 replies
  • 133 views

JR33
QPN Level 2 ●●
Forum|alt.badge.img+10
  • QPN Level 2 ●●

Hello,

I made a workflow with multiple calculation, based on embedded data, with a JS code task. My trigger is an Experience ID when any change happen for any contact.

I have a issue when a embedded is missing for one contact. The task is getting on error. I understand why but I need to find something for contournate this problem. I’ve tried to check if the ED is null or undefined but nothing work. Qualtrics doesn’t want to execute a task with an embedded called but no existed.

Here is an exemple of my work:

function codeTask() {

var1 = ~{qde://supplemental.embeddedData.AS_COMPLETED_CAMPAIGNS}
if (var1 != null) {
KPI_AS001=1;}
else {
KPI_AS001=2;}



return {
KPI_AS001
};
}

Thanks for your help,

J.

2 replies

Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • June 27, 2023

Please check the value of ED being taken when it is missing. May be then you can handle it.


Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • June 27, 2023

Check what is the value of the ED when  it is missing from contact. May be then you will be able to handle.