Is it possible to add a message to the app screen that pulls the users name from a data source?
I.e Hello, “users name”
Is it possible to add a message to the app screen that pulls the users name from a data source?
I.e Hello, “users name”
Hi Mel,
This is relatively easy to achieve with some custom code. You want to first go to developer options > HTML and add the following HTML:
<span class="personalMessage"></span>
Under the javascript tab you want to add the following:
Fliplet.User.getCachedSession().then(function (session) {
var user = _.get(session, 'entries.dataSource.data');
if (!user) {
return; // user is not logged in
}
//Here we want to insert the text containing the logged in users name into the span we created.
//In this case the logged in user has first name and last name stored in different data source columns.
$('.personalMessage').text('Hello, ' + user["First Name"] + '' + user["Last Name"])
});
The above will insert the text into the span and will show the message “Hello, [users name]”. Feel free to change the message as needed.
If you would like to style your message you can target that using CSS:
.personalMessage{
font-size: 20px;
color: red
}
Hope this helps,
Deb