Solution execution step condition | XM Community
Question

Solution execution step condition

  • 1 November 2023
  • 5 replies
  • 112 views

Badge +1

Hi everyone,

I'm trying to build my first xm solution extension.
In my solutionExecution.json, i have multiple steps with a condition attribute like:
"condition": "[setup.answers.Survey3, false]",

https://developer.qualtrics.com/developer/portal/documentation/d78fd60a3162a-solution-execution#step-properties
Survey3 is checkbox defined in the setup.
Build et validate are running ok but when i try the extension, i have an error on submitting the setup page : "There was a problem while trying to save the page. Please try again later or contact Qualtrics customer support."
If i replace the condition with "condition": "true", there is no error.
I tried with "condition": "[context.setup.answers.Survey3, false]" but the generated tests failed.

I’m certainly doing something wrong but can’t find out what. 


Thanks, 


5 replies

Userlevel 1
Badge +5

Hi @DamienP !

 

Have you tried using the square brackets without quotes? 

"condition": [setup.answers.Survey3, false],

Give that a shot and let me know how it goes.

 

Hubert

Badge +1

Hi @qHubert  !

Thanks for your response.

I gave it a shot but the json is invalid and build failed.

I tried this too:

"condition": ["setup.answers.Survey3", false],

but build failed too with this error => json: cannot unmarshal array into Go struct field V3WorkflowStep.steps.condition of type string

 

Damien

Userlevel 1
Badge +5

Oh, right. Of course. 

Let me look into this. Are you trying to conditionally create something? If so, what and what else are you doing in solutionExecution.json?

Badge +1

Yes, the goal is to have multiple checkbox in the setup page and to create the corresponding project.

For tests i have simplified my solutionExecution.json to one project. ( i m aware i should always have at least 2 step, but the error occur even if i have more “static” step).

 

{
"apiVersion": "workflow.v3",
"setup": {
"formFilePath": "Resources/testd.json"
},
"config": {
"description": "This is an example for building a survey resource",
"disableGuidanceSidebar": true
},
"steps": [
{
"id": "createSurvey",
"type": "Create",
"condition": "[setup.answers.Survey3, false]",
"config": {
"apiVersion": "survey.v0",
"templateFilePath": "Resources/survey.json",
"transformationFilePath": "Resources/modifySurvey.js"
}
},
{
"id": "locationSetting",
"type": "SetLocation",
"config": {
"setLocation": {
"type": "Product",
"section": "EditSurvey",
"sectionData": {
"surveyId": "createSurvey.surveyId"
}
}
},
"dependencies": ["createSurvey"]
}
]
}

 

Badge +1

Hi,

I just need a way to conditionnaly create ressource.
I tried to do it in the transformation file by returning a null ressource when conditions are met but that's not working either.
Do you know any other way to do it or spot something wrong in my code @qHubert  ? 

 

Thanks

Leave a Reply