Hello,
I can’t understand how static variables work.
First I explain what I want to do and then how I have configured it.
I want that when the main flow (Appointment booking) of my workflow fails for any reason in any of the nodes, another flow within the same workflow is automatically activated to send a message to the client that there has been an error in the booking process.
Based on this page getWorkflowStaticData | n8n Docs my configuration has been the following:
You can see that if I manually write my phone number it sends the message correctly but when I put the static variable it does not. As the output of the http request node is the following = ‘number’: ‘’
I am very new to programming and coding, if you can explain it to me in the best possible way or tell me what is the exact code I would appreciate it.
Thanks for your time
Hello, have you triggered the workflow manualy ?
No, this example is with production URL webhook
ok thank that was just to be sure, as it is a primary condition for it to work.
second i see in you first image when you set the phone number you use $json[‘phone’] but the item is called phoneNumber in the edit1 node
yes that is you try to access the value phone in the code node, but in the $json you have the last node entry… the one of edit1 which is phoneNumber.
If you wanna access specifically the phone value in the code node.
it will be something like
$(‘code’).first().json.phone
now it seems that the output of code1 is correct, but the http node still does not receive the correct information.
Hello Ivan,
Yes it is because you made a mistake in your code
in the documentation they show you
// Get the global workflow static data
const workflowStaticData = $getWorkflowStaticData('global');
// Access its data
const PhoneNumber = workflowStaticData.PhoneNumber;
in your code you call $workflows.getStaticData some << this is not the good call
try and let me know if it work ! 
I’m a bit lost, sorry 
Now I tried with this codes and it still does not work.
I also tried with:
“number”: “{{ $getWorkflowStaticData(‘global’) }}”
and
“number”: “{{ PhoneNumber }}”
and nothing…
hello Ivan,
so yes it didn’t work because in the array you have
“number” : “{{ $getWorkflowStaticData(‘global’).Phonenumber }}” << it is phoneNumber (sorry my mistake in my previous message) (as in the line 4 of code1 you have to have the same spelling in both).
you want to have “number” : {{ $getWorkflowStaticData(‘global’).phonenumber }}
ALSO look closely after the : there is NO " because it is a number not a string