Get hidden input value saved in my leads field

Hi everyone - this is my first post here. I’m using a Jornaya script to generate a Jornaya leadid for each user session. That part is working as I see those values getting saved in their admin. I also see in inspect element elements that the Jonaya leadid is getting saved in the value of a hidden input field I created, this is what the it looks like , took out the <> since it wouldn’t display here: input id=“leadid_token” name=“universal_leadid” type=“hidden” value=“A1DE6B4A-5292-C05B-FA0A-AFCC597420B4” . My problem is getting this value from the session into my leads data type field called UnversalLeadid. I’ve tried creating an additional Javascript code that get’s triggered on click of a button with a run javascript script, captureLeadid();, … the javascript code is:

function captureLeadId() {
console.log(‘captureLeadId function called’); // Confirm function is called
var leadidToken = document.getElementById(‘leadid_token’).value;
console.log(‘Lead ID Token:’, leadidToken); // Log the value for debugging
alert('Lead ID Token: ’ + leadidToken); // Alert the value for debugging
bubble_fn_set_leadid(leadidToken);
}
Then I created a new workflow event triggered when the javascripttobubble value is not empty which has an action of updating the UnversalLeadid field to the javascripttobuble value. It’s not working. The value is not getting updated. Can anyone help me get the hidden input value in session stored into the UnversalLeadid field? Let me know if you need further information. Thanks!

Hey @tom20 :wave:

First, you can show code by putting them inside either a single tick ` or triple ticks if it has multiple lines (example below).
<input id=“leadid_token” name=“universal_leadid” type=“hidden” value=“A1DE6B4A-5292-C05B-FA0A-AFCC597420B4”>

Is this the whole JS code inside Run javascript action? If so, you just define a function here. You don’t call it. The last line of the JS code should be captureLeadId(); if you want to execute it as well.

Hey @hergin - thanks for your info. I have configured a Run javascript action triggered by the button click on the page that executes the function captureLeadId();, but it has never worked.

You should give more details. Did it never work? Did it at least execute and showed the first console.log message? Depending on these, problem might be in different places.

This topic was automatically closed after 70 days. New replies are no longer allowed.