Globals being pass to a device and back again

Hi, I apologize if this has been asked before already I tried looking around and a lot of the stuff was similar but not exactly getting me where i needed.

Anyways I was wondering if there is an easy way to pass global data around when using device commands

Im using the CPF template and it uses globals to get the webpage icon and title, which works fine if endpoint call goes to edge point response

but if you call a device state and use mqtt to get a response back you lose the globals (since you cant send the whole payload as an option like in endpoint responses) as can be seen when trying to render this webpage


image

and a janky solution seemed to be to pass the globals along in the payload, but then when it gets around to rendering the page the globals are in the payload, which makes sene duh, but im not sure what to do to pass the globals around then.
image

I know there is a globals tab, which might be useful? but the globals im seeing arent in there, so it seems they are auto generated?

Hey @Tanner_Williams,

I believe you can use Application Globals to achieve the result you’re looking for.

There are multiple levels of globals:

  1. Workflow Globals are only available in the specific workflow in which they’re defined. This is the globals tab you can see in the workflow editor.
  2. Experience Version Globals are available in every experience workflow. These are the CPF globals that you see. They’re defined at the experience level so every experience workflow can access them.
  3. Application Globals are available in every workflow (edge, application, experience).

So, if I understand your use case correctly, if you add an application global it will be available in both the experience workflow that sends the device command and in the application workflow that handles the MQTT response.

1 Like

Thank you I was able to figure out what I needed