tthias
November 27, 2020, 9:56am
1
Hello,
I’m able to trigger a flow from a JS function but I can’t get it have a param:
My flow have an input param ‘user’ that is an object:
<script is="dmx-flow" id="userAuth" type="text/dmx-flow">{
meta: {
$param: [
{type: "object", name: "user"}
]
},
And there is my code to trigger the flow:
Outseta.on('accessToken.set', function (user) {
dmx.global.set('user', user);
dmx.parse('userAuth.run(user,'+user+')');
});
I have tried many ways but can’t find the good one. The dmx.global.set works fine, but I would like to set the user variable in the flow directly. And set a global variable and retrieve it on the flow.
Thanks a lot,
patrick
November 27, 2020, 10:19am
2
You pass the param incorrectly, use:
dmx.parse('userAuth.run({ user: user })');
tthias
November 27, 2020, 10:51am
3
Thanks for your reply I have change the code a bit to make it simpler
<script>
Outseta.on('accessToken.set', function (user) {
let accountId = "rmkNODWg"
dmx.parse('userAuth.run({ accountId: accountId })');
});
</script>
</head>
<body is="dmx-app" id="main">
<script is="dmx-flow" id="userAuth" type="text/dmx-flow">{
meta: {
$param: [
{type: "text", name: "accountId"}
]
},
exec: {
steps: {
bootbox.alert: {message: "{{'Hello '+$param.accountId}}", title: "Title"}
}
}
}
But my alert message is not showing the accountId.
What I’m missing ?
Thanks !
patrick
November 27, 2020, 11:06am
4
let accountId = "rmkNODWg"
is not accessible from the expression, use dmx.global.set('accountId', accountId);
to make it accessible.
Or change the flow run action to dmx.parse('userAuth.run({ accountId: "' + accountId + '"})');
.
1 Like
tthias
November 27, 2020, 12:13pm
5
That works perfectly
Is there any full dmx documentation ?
For exemple I’m looking to trigger a flow when a global value changes