@{LOGGED_IN_USER:NAME} For personalized content

Hi all, would be cool if we could use @{LOGGED_IN_USER:NAME} to personalize content.

Ex. CRM Dashboard. "Good morning {LOGGED_IN_USER:NAME}, you got 100 new leads to work on!

Thanks for considering it and keep up the good work! Softr is ground-breaking!

p.s: like this feature on typeform

2 Likes

You can do this with a custom code block. For example:

<div id="welcome" class="sw-font-family-default"<p class="h2"></p></div>
<script>
    document.getElementById("welcome").innerText = "Hi there, " + logged_in_user.softr_user_full_name;
</script>
3 Likes

awesome, thanks a lot @dcoletta !

1 Like

An upgrade on this feature request would be to be able to add dynamic airtable content into labels. i.e. as I am creating a marketplace I want to be able to welcome them by there business name which is a column in my airtable.

Unless you have any @dcoletta ?

Thanks so much!

1 Like

Can you say a little more about what you mean by ā€œlabelsā€? Can you post a mockup of what youā€™d want it to look like?

@dcoletta this is what I mean by ā€˜labelsā€™. They are often the titles of sections.

But where I have put the ****, it would be great to be able to add in dynamic airtable content. In the scenario I would want to add the name of the business who listed the class.

Got it. I wasnā€™t sure if you meant labels on filter settings, labels on data fields, or both.

I know how to write this custom code but Iā€™m afraid this is a tough time of year to find the time. Iā€™m making notes to myself here so I can come back to it later, or maybe someone else will take a crack at it.

The basic approach is this:

  • In the studio, annotate your labels with {{fieldName}} annotations. So in your example, assuming your Airtable field was called ā€œBusiness Nameā€, youā€™d type More Activities from {{Business Name}} into the Label field of the Filter Settings.
  • In a custom code block, write code that does this:
    ā€“ wait until the label has been added to the DOM of the page. If itā€™s a data field label, we have to wait until the Airtable record has been fetched from the server.
    ā€“ search through the page DOM for text that looks like {{fieldName}} using code similar to var i = document.evaluate("//p[contains(., '{{Name}}')]", document); n = i.iterateNext(), and for each one found, extract the field name from between the double curly brackets with code similar to var propName = n.innerText.match(/{{(.*?)}}/g)[0], then look fieldName up with fieldValue = window.records[keys(records)[0]].record.fields['fieldName'] and replace {{fieldName}} with that value with code similar to node.innerText.replace(/{{(.*?)}}/g, fieldValue)
3 Likes

@dcoletta totally get it! thankyou for the notes - No rush so will come back to it in the new year :slight_smile:

1 Like

Yes, being able to add dynamic content into field labels and within text blocks would be incredibly useful and offer a more personalized user experience. The ability to create content block templates that merge field values into a text template, especially in combination with form fields or a signature block would be amazing for workflows that require approvals.

1 Like

Fully agreed that being able to access Airtable field values for use within button names, regular text fields, et cetera would be a game changer.

Hi @dcoletta and @Anna were you able to figure out a way to customize the labels with field data? Thanks!

Hi @dcoletta and @Anna,
I hope youā€™re both doing well :slight_smile:
Did you end up figuring out a way to add a {LOGGED_IN_USER:NAME} in another block type than Custom Code (e.g. Hero blockā€™s title)?

@Yann here we go: How to show logged in user's name in the website - #26 by artur

Thank you @artur.
However it is still not working for me: nothing appears.

@Yann Can you DM me a link to check ?

Hello,

We still cannot use dynamic content into texte ? (e.g You still have XXX credits)

I donā€™t understand how to do, but seem to be very basic featureā€¦

Thank you

Hi @Mathieu.I ,

Welcome to the community! At the moment, you can access the logged_in users fields. You can confirm what fields you have access to by adding a custom code block on the page, and typing in ā€œLogged_in_userā€ - from there the available fields will show in the dropdown for you.

Screenshot 2024-06-11 at 2.34.38 PM

However, itā€™s limited to that at the moment. We understand the need to expand this, and have it in our plans, but canā€™t give a date on when it might be released at the moment.