Pass variables from one component to another

i have created a layout page and having two components in it , now I want to pass variables from one to another

Hi @Dinesh_Kumar !

Can you provide some more details on your Experience dashboard? What kind of components and variables are you referring to, and what is the objective?

I have page layout , in which I am calling two components , one is having dashboard and another one is having some custom html.
Component having Dashboard:
a context variable is defined in the dashboard , and Calling in component this way :


.The value of context variable is coming from exp user tag

component having custom HTML:
image

In this Input field is there , when the user hits submit button an workflow runs to change the value of experince usertag
image
I have used user update node in workflow and update the property.
image

on submit the form with some input , the value of exp usertag is updated but the context variale value is not get at that time updated . but if I reload the page value gets upadted in dashboard.

i also tried using ctxChange event in dashboard, but no success.

So it sounds like you are expecting changes to your experience user to automatically appear in the resolved context object. Currently, we only validate and resolve context variables on the dashboard’s initial mount - though I do think it is reasonable to expect updates to devices and experience users made elsewhere - whether in a form on the same experience page or through some other process - to be reflected in the dashboard.

I will file a feature request around this. We can at least poll the endpoints (re-request regularly) that validate dashboard context and return the dashboard layout itself; I do not know if we can open a stream that would send such updates down in real time.

In the meantime, I suggest not submitting your form asynchronously and allowing the page to fully reload on submission. I understand this is less ideal than an immediate update but it is better than your data being out of sync.

Also, one unrelated suggestion: I see that you are submitting the form as a GET request. HTTP specifications dictate that a GET request should never alter the state of your application, which your form is doing if it is updating a tag on an experience user. (Browsers may also cache this response, which you do not want in this case.) I would recommend changing the endpoint’s method - and your form’s submission method - to PATCH or POST.

Just wanted to follow up on this thread. With today’s today’s platform update, in the Custom HTML Block, we now expose a method for re-fetching data for all dashboard blocks.

@Dinesh_Kumar , for the use-case you brought up this thread, this means that a change to an experience user can be reflected in the dashboard immediately after the request resolves. Please give this a look and let me know if you have any questions!