@{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

1 Like

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

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

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)

@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 ?