Fred_K
February 2, 2022, 12:25pm
1
On page load, a flow runs to check if the key in the url param exists in the database.
If uuid does not exist, user goes to hell. But here condition does not do its filtering as expected.
How do I use condition within flow?
<script is="dmx-flow" id="flow1" type="text/dmx-flow" autorun>[
{
serverConnect: {
url: "dmxConnect/api/Admin/checkAccessCode.php",
site: "ProjectX",
params: {key: "{{query.key}}"},
name: "scGetAccessCode",
output: true
}
},
{
wait: {delay: 500}
},
{
condition: {
if: "{{!scGetAccessCode.data.qryStoredUUID.uuid}}",
then: {
steps: {
run: {action: "{{goTo.goto('/invalid-invite')}}"}
}
}
}
}
]</script>
Teodor
February 2, 2022, 1:51pm
2
What exactly do you find wrong here? You check if scGetAccessCode.data.qryStoredUUID.uuid does not return a value:
if: "{{!scGetAccessCode.data.qryStoredUUID.uuid}}",
and if it does not return a value you redirect.
From your screenshot it seems that the scGetAccessCode.data.qryStoredUUID.uuid does return a value:
Fred_K:
So the redirect does not run.
What exactly is the issue here? It works as expected from what I see.
Fred_K
February 2, 2022, 2:09pm
3
You got it right.
But the flow always redirects to ‘invalid-invite’ when the qry does return a matching uuid.
So I’m guessing something is wrong in the condition function?
Teodor
February 2, 2022, 2:29pm
4
Are you sure your query does return an uuid then? And how do you check that?
Fred_K
February 2, 2022, 2:31pm
5
The dev tool does tell me a matching uuid is returned:
Teodor
February 2, 2022, 2:33pm
6
So the flow is calling the redirect?
Fred_K
February 2, 2022, 2:40pm
7
Yes it does. But it should not.
Sorry, I’m no the best at describing in technical terms.
Is it possible that you have also added the server connect to the page and used the same name, perhaps causing a conflict?
Fred_K
February 2, 2022, 2:52pm
9
I actually “moved” the server connect inside the flow as I first thought it was the issue (SC lag preventing condition to check on the query). I only have one SC in this page and it is inside the flow.
Fred_K
February 2, 2022, 3:56pm
10
I removed the whole flow and one container show/hide condition on the page and re-set them and now seems to work fine.
Confused but happy it seems fixed.