Custom script to preview the user data in a custom code block

Place this in your custom code block and preview

<div id="user-data"></div>
<script>
window.addEventListener('DOMContentLoaded', () => {
        if(window.logged_in_user) {
            let userData = document.createElement('span').innerTex = window.logged_in_user;
            let container = document.getElementById('user-data');
            let ul = document.createElement('ul');
            for (let key in userData) {
                  if (userData.hasOwnProperty(key)) {
                    var li = document.createElement('li');
                    li.innerHTML = '<strong>' + key + ':</strong> ' + userData[key];
                    ul.appendChild(li);
                  }
                }
            container.appendChild(ul);
        }   
});
</script>
1 Like

giphy

Best information of the month.

1 Like

Whats is the variable for : {LOGGED_IN_USER:AT_RECORD_ID}? (this one is not working for me)

I need to add at the end of an url link, the record id of my logged user. All of this within an embed code

Below my code What Am I doing wrong?

<div style="width:100%;height:500px;" data-fillout-id="xxxxxxxxxx" data-fillout-embed-type="standard" data-fillout-inherit-parameters data-fillout-dynamic-resize></div>
<script src="https://server.fillout.com/embed/v1/?BDID={LOGGED_IN_USER:AT_RECORD_ID}"></script>

Ive found my answer here (at the very bottom) How to embed Fillout forms in Softr

1 Like

Thanks for the update @Charle !