Hello,
i start a workflow from a button.
in this workflow i need some of the informations of the thisinstance - but not from the buttom the workflow starts, but from another element (div).
how can i get that?
i can give the element an id but id.thisinstance didnt work…
any ideas?
thanks for help.
PS: The AI gives this (but i dont understand, what to to)
// Get the instance of the element with ID hpa2401
const outputHPPInstance = context.workflow[‘hpa2401’];
// Return the instance information
return outputHPPInstance;
but this is: undefiend…
To access the thisInstance information of the element with the ID hpa2401 named “> Output HPP 100%”, you can use the following approach in WeWeb:
Identify the Element: Ensure that the element with ID hpa2401 is correctly referenced in your code or workflow.
Access thisInstance: You can access the thisInstance properties by using the context of the element. For example:
javascript
Copy code
const outputHPPInstance = context.workflow[‘hpa2401’];
Retrieve Properties: You can then access specific properties of the thisInstance as needed, such as:
javascript
Copy code
const height = outputHPPInstance.height;
const width = outputHPPInstance.width;
Make sure to replace the property names with the actual properties you want to access from the thisInstance.
Hi Stephan 
We’re going to need more information in order to help you.
What do you mean by thisinstance, what is this element you are talking about?
What information are you trying to retrieve from this div?
Can you upload a couple of screenshots on how your project is set up? A video would also help.
In Weweb you can reference almost any element and data in your page inside the formula creator in the workflow editor.
Hey Agustin,
thank you for your reply.
with “thisInstance” i mean teh thisInstance Object i can choose in a formular where i bind something for example in a css property to an element.
from that i get a lot of informations about that objekt.
i need especially the offsetHeight in a workflow.
the problem is, that the workflow starts from an other element (button). so if i use the workflowstep “return a value” i get the informations of that element (button).
so i look for a possibility to get the “thisInstance”-Informations from an other element. i read something from context.thisInstance but i dont understand, what that mean.
how can i tell the “return a value”-formular, from what element it should take the “thisInstance”-Information?
is there the posiibility to do that?
thanks for more help.
stefan
Maybe there’s a way where as a first step you save the this.instance value inside a variable and then on another workflow you can call this variable directly ? (instead of trying to access the “thisinstance” from another place)
Yes, that was a possibility. but unfortunately the value ist not fix (because of that i need to get it at that moment, when i start the workflow).
the problem is the height auto value with the transitions.
i want to close an open div (and it go to height = 0). so the div is instantly disappearing, and the transition of the opacity is not to see.
on opening the div the transition works (because the height become from 0 to auto, so the div is instantly there, and the opacity can come with the transition. but on closing it dont work, so i want to give the div the height in pixel, that it can role away to height = 0.
in this moment i think: perhaps i need a thrid state. first i change only the opaciti give a delay in the workflow and then change the height to 0.
pfffff…
maybe you can use a html ID on the component attributes? set a ID on html field and return the value by id.
1 Like
Hi Guillenius,
thank you for your reply.
i can set an id as attribut. but how can i adress this id then in the formular?
with “myid.thisInstance” it didnt work…
stefan