{{request_contact}} object is empty on first page load
SOLVE
I am using bunch of contact properties via request_contact object in templates and modules(eg. request_contact.contact.email) but sometimes it gives empty results on first page load right after I am submitting a form with hubspotutk value to set the user identity in his/her browser.
{{request_contact}} object is empty on first page load
SOLVE
Thank you for the clarification @shivammishra - That makes total sense now.
I'm honestly not sure if HS pushes the data into a queue before attaching it to the user. They might be doing that to improve response times of their API calls. This does sound like a question for a bigger gun than myself. (or maybe you found a real life legit bug). Can you pass the data as URL parameters instead?
You might also have better success posting the question in
{{request_contact}} object is empty on first page load
SOLVE
So I tested it thouroughly and found that its because of the time hubspot APIs take to update the record as mentioned by @tjoyce and I am not sure if support would be able to help much here for this one usecase so I have handled it by checking at my end and only letting the user move forward when API sends the updated response. That way user sees the page only when {{request_contact}} object has the updated data.
{{request_contact}} object is empty on first page load
SOLVE
So I tested it thouroughly and found that its because of the time hubspot APIs take to update the record as mentioned by @tjoyce and I am not sure if support would be able to help much here for this one usecase so I have handled it by checking at my end and only letting the user move forward when API sends the updated response. That way user sees the page only when {{request_contact}} object has the updated data.
{{request_contact}} object is empty on first page load
SOLVE
So user first lands on a hubspot page where hubspotutk cookie gets generated then I redirect user to a separate nodeJs application [outside hubspot] where I submit the form with hubspotutk cookie value using form submission API (https://legacydocs.hubspot.com/docs/methods/forms/submit_form ) and then I am redirecting user to another hubspot page where I am trying to show user's first name which does not happen at first load.
In another scenario, I update one of the contact's custom property via serveless function which is called in a hubspot page using ajax and then I redirect user to another hubspot page where I am trying to show the value of that custom property but its empy on first load.
{{request_contact}} object is empty on first page load
SOLVE
Thank you for the clarification @shivammishra - That makes total sense now.
I'm honestly not sure if HS pushes the data into a queue before attaching it to the user. They might be doing that to improve response times of their API calls. This does sound like a question for a bigger gun than myself. (or maybe you found a real life legit bug). Can you pass the data as URL parameters instead?
You might also have better success posting the question in
{{request_contact}} object is empty on first page load
SOLVE
@shivammishra - I might need more information on your data flow but, I think it does make sense that it's empty if you're setting the contact properties via javascript.
There are a couple of things to note...
1. {{request_contact}} is server side code so, if you're setting the utk in js, you would need to do a hard refresh on the page to re-render that dict properly
2. Be mindful of where the form is rendered and submitted in the page's javascript callstack. Although the forms appear quickly (visually) - it is generally loaded at an inconsistent time during page load and sometimes the data might be available and sometimes it isn't. so, if you are trying to populate a form, make sure you're using the javascript global events form callback api
{{request_contact}} object is empty on first page load
SOLVE
This is actually happening to me on my chromebook while entering the outcome for calls. When I use my partners ASUS it loads perfectly, every time the first time. When I use my chromebook I have to reload every page to code the call properly. I can always leave notes but most of the time my fields are empty.