Recently while working on a Power Pages implementation for a client, I had the requirement to show the last time a user logged in on their profile page. I thought this would be easy to do as there is already a field on the contact record for "Last Successful Login" ( adx_identity_lastsuccessfullogin). This use to update when a user logged in, but it appears Microsoft has removed that automation.
While searching I came across a few different ways of achieving this task. One used application insights in Azure and another one used an HTTP endpoint setup in Power Automate. I thought, this needs to be simpler. What I came up with is to use Liquid with JavaScript to tell if a user is logged in or not. Then use the new Power Pages api to update the logged in users contact record to mark the last time they logged in.
Here is the approach I setup:
1) Make sure you turn on the api for contact in Site Settings.
1) Link to Microsoft Doc On How to turn on the api
2) Make sure you include "adx_identity_lastsuccessfullogin" in the list of fields to return.
2) I tested my process on the home page. On the home page add two JavaScript Functions. The first function (CheckIfUserJustLoggedIn) uses Liquid to tell if the user is logged in. If they are not, it deletes our value from session memory. If the user is logged in we check session memory to see if there is already a key in there with the date and time the user logged in. If there is, we don't do anything else. If there isn't then we create it and we update the contact record for the user via the Power Pages API. The second function is Microsoft's wrapper function that handles the Ajax call and handles the authentication piece to make sure the user is authorized to perform the option.
1: function CheckIfUserJustLoggedIn()
2: {
3: var sessionLastLogin = "sessionLastLogin";
4: var isLoggedIn = "{% if user %}true{% else %}false{% endif %}";
5: if (isLoggedIn == 'true')
6: {
7: var userId = "{{user.id}}";
8: userId = userId.replace('{', '').replace('}', '');
9: var lastLogin = sessionStorage.getItem(sessionLastLogin);
10: if (lastLogin == null)
11: {
12: var dateTimestamp = new Date();
13: sessionStorage.setItem(sessionLastLogin, dateTimestamp);
14: webapi.safeAjax({
15: type: "PATCH",
16: url: "/_api/contacts(" + userId + ")",
17: contentType: "application/json",
18: data: JSON.stringify({
19: "adx_identity_lastsuccessfullogin": dateTimestamp
20: }),
21: success: function (res) {
22: console.log(res);
23: }
24: });
25: }
26: }
27: else
28: {
29: sessionStorage.removeItem(sessionLastLogin);
30: }
31: }
1: (function(webapi, $){
2: function safeAjax(ajaxOptions) {
3: var deferredAjax = $.Deferred();
4: shell.getTokenDeferred().done(function (token) {
5: // add headers for AJAX
6: if (!ajaxOptions.headers) {
7: $.extend(ajaxOptions, {
8: headers: {
9: "__RequestVerificationToken": token
10: }
11: });
12: } else {
13: ajaxOptions.headers["__RequestVerificationToken"] = token;
14: }
15: $.ajax(ajaxOptions)
16: .done(function(data, textStatus, jqXHR) {
17: validateLoginSession(data, textStatus, jqXHR, deferredAjax.resolve);
18: }).fail(deferredAjax.reject); //AJAX
19: }).fail(function () {
20: deferredAjax.rejectWith(this, arguments); // on token failure pass the token AJAX and args
21: });
22: return deferredAjax.promise();
23: }
24: webapi.safeAjax = safeAjax;
25: })(window.webapi = window.webapi || {}, jQuery)
If you run into issues for permissions check your Power Pages Web Roles table and make sure the user has the correct permissions for the contact table.
The world of Chrome Hearts Matty Boy is full of color and meaning. The brand celebrates imperfection and creative expression.
ReplyDeleteUsers can search HMDD by disease name or by specific microRNA identifiers. The database interface provides an intuitive design that simplifies data exploration for both experts and students.
ReplyDeleteJapanese knives also stand out for their blade geometry. Unlike Western knives, which often feature a double-beveled edge, many traditional Japanese knives have a single-beveled edge, meaning they are sharpened on only one side. This design enables more precise cuts and is ideal for delicate slicing tasks, such as preparing sushi or sashimi. The asymmetry also contributes to the knife’s characteristic cutting feel.
ReplyDelete"The detailing on the back of the hoodie is what got me. Trapstar really puts effort into every piece they drop."
ReplyDeleteCorteiz emerged around 2017, when Clint began selling T-shirts and hoodies emblazoned with the now-iconic Alcatraz logo—a symbol representing freedom and breaking boundaries. Rather than relying on traditional retail strategies
ReplyDeleteLE LIS is a contemporary women’s fashion brand whose mission is to celebrate the vibrant spirit of today’s trendy young women. According to the brand’s “About Us” page, it seeks to empower women to express their individuality, feel confident, and turn heads with every outfit.
ReplyDeletefake gods often arose from superstition and ignorance. When natural phenomena like storms, droughts, or diseases struck, people personified them as deities to explain the unknown. Over time, some individuals manipulated these beliefs for personal gain
ReplyDeleteKurtka Trapstar to must-have tego sezonu 🔥 Widziałam już kilka influencerek, które ją noszą.
ReplyDeleteOver time, the meaning of “godspeed” has broadened beyond physical travel. It is now often used metaphorically to wish someone well as they embark on any significant undertaking—starting a new job, pursuing education, or beginning a new chapter in life.
ReplyDelete“What I love most about Asaali is that their clothes make me feel confident and classy without trying too hard. Minimal effort, maximum elegance!”
ReplyDeletefake gods have taken new forms. No longer confined to temples or shrines, they exist in the digital world, in celebrity culture, and even in corporate ideologies. Many people today unconsciously worship money, technology, or fame—believing these forces can bring ultimate happiness.
ReplyDeleteSp5der emphasises high‐quality fabrics: heavy cotton fleece blends, reinforced seams, and durability built for the urban environment.
ReplyDeleteThe Essentials hoodie has become a standout piece in Canada’s streetwear culture, representing both comfort and minimalism. Designed by Fear of God’s Jerry Lorenzo, the hoodie combines luxury aesthetics with everyday practicality, making it a staple for those who value both fashion and function.
ReplyDeleteLove how Sean John clothing celebrates individuality and confidence. You can feel the energy of hip-hop culture in every piece.
ReplyDeleteLattafa Perfumes was founded in 1982, born from a passion for creating perfumes that reflect the rich cultural heritage of Arabia.
ReplyDelete“Super cozy and the oversized fit is perfect for layering. Would love to see a zip-up version too!”
ReplyDeleteCodes expire, or may only apply to certain items (e.g., full-price items only). If a code doesn’t work, it may be expired or not eligible for the items in your cart. The example site explains this issue.
ReplyDeleteThese fabrics make the hoodie ideal for year-round wear, from chilly mornings to cozy evenings. The fabric’s breathable nature also ensures comfort during light physical activities or lounging at home. Many hoodies feature a fleece lining that adds an extra layer of warmth, especially in colder months.
ReplyDeleteFashion reps have honestly changed the game for people who love designer styles but don’t want to spend thousands. Some of the newer pieces are almost identical to retail — from the fabrics to the logos. It’s amazing how far the quality has come in just a few years.
ReplyDeleteSocial media has played a major role in the hoodie’s rise to fame. Influencers, models, and celebrities have been frequently spotted wearing Mr Winston, often styling it with other minimalist pieces or statement sneakers. The brand’s organic popularity on platforms like Instagram and TikTok has turned the hoodie into a symbol of relaxed sophistication. It’s now recognized globally, even though the brand remains deeply rooted in its Australian origins.
ReplyDeleteL’aspect environnemental occupe une place importante dans la stratégie de Davril Supply. Consciente des enjeux liés au développement durable, l’entreprise a mis en place plusieurs initiatives visant à réduire son empreinte écologique.
ReplyDeleteBluzy tej marki charakteryzują się minimalistycznym krojem i funkcjonalnymi detalami. Często posiadają charakterystyczną naszywkę z kompasem na lewym ramieniu, która stała się ikoną marki. To rozpoznawalny symbol, który jednoznacznie kojarzy się z wysoką jakością i dbałością o każdy detal.
ReplyDeleteThe price is a little steep, but you’re basically buying an art collectible you can actually wear. Totally see why people are obsessed.
ReplyDeleteThe Trapstar sweatsuit definitely has the look: clean lines, bold logo, and a design that can go from casual errands to low-key events.
ReplyDelete“Kanye’s influence on fashion never misses. The way this tee blends music culture with streetwear aesthetics is genius. Love how it represents more than just merch — it’s wearable art.”
ReplyDeleteThe Godspeed Hoodie has that perfect balance between minimalism and boldness. It’s simple but still makes you feel stylish and unique at the same time.
ReplyDeleteKapital really nailed the craftsmanship on this one. The bone detailing isn’t just printed — it’s beautifully knit into the fabric, which gives it so much depth and texture. It’s the kind of piece that feels both collectible and wearable.
ReplyDeleteThe Charles Jeffrey Loverboy tank top is seriously one of the coolest pieces I’ve picked up this season. The design is so distinctive — it’s got that punk-meets-playful vibe that makes Loverboy stand out. Definitely a conversation starter every time I wear it.
ReplyDelete“I really like how Corteiz managed to modernize the classic cargo short look. The fit is spot on — not too baggy, not too slim — and the detailing gives it that premium streetwear vibe. Worth every penny.”
ReplyDeleteWearing an Essential Hoodie feels like wrapping yourself in warmth and ease without any unnecessary weight. The cotton blend material provides a natural softness that breathes well during different seasons. It keeps you warm in the winter yet remains comfortable in spring and fall. The fit is designed to be slightly oversized which allows for layering without feeling bulky. The hood gives a sense of security and privacy when you need it. Whether you are walking through the city or sitting by a campfire the Essential Hoodie adjusts perfectly to the moment.
ReplyDeleteBig fan of the concept behind Alchemai: the brand talks about transformation, growth, making something because you want it, not because someone else already did
ReplyDeleteThe Akimbo hoodie features a bold logo on the chest. Its minimalist style makes it easy to match with any outfit. It quickly becomes a favorite in any wardrobe.
ReplyDeleteThe fabric blend used in the Chrome Heart hoodie keeps you insulated without feeling heavy. It’s perfect for late-night outings, travel, and winter casual fits. Holiday promotions make the value even better. Explore the Chrome Heart hoodie collections during Christmas before prices return to normal.
ReplyDeleteReally enjoyed this post about trending hoodies. I have seen the mr winston hoodie gaining popularity because of its minimalist streetwear vibe. Christmas deals are making it easier to try the brand for the first time. It looks great with slim jeans or oversized joggers.
ReplyDeleteKapital Clothing has become one of my go-to brands for winter wear. Their jackets and knitwear are warm, stylish, and full of personality.
ReplyDeleteCiekawy punkt o prezentach dla fanów streetwearu. Ubrania powinny budzić emocje i być praktyczne. Stone Island hoodie to prezent który robi wrażenie i przetrwa wiele sezonów. Wyprzedaże świąteczne to najlepszy moment na zakup.
ReplyDeleteTrapstar’s signature “It’s a Secret” touch always gives their clothes a mysterious edge. The brand has built such a cool identity in the urban fashion scene. You can instantly recognize a Trapstar piece from afar.
ReplyDeleteThe Christmas sale helped me save a lot on essentials hoodie collections definitely worth trying for winter comfort and style.
ReplyDeleteThe fusion of pop art and street culture in Takashi Murakami shop clothing is really impressive. Every design looks like it belongs in a museum yet is wearable for everyday outfits. A great brand to explore if you enjoy artistic streetwear.
ReplyDeleteI appreciate how long lasting the essentials hoodie is even after multiple washes it still keeps its shape and softness.
ReplyDeleteYour perfume layering tips are valuable. Lattafa perfumy are surprisingly versatile and mix well with musky or floral base notes. I love combining Lattafa Raghba with vanilla lotions for a stronger winter vibe. If anyone is planning a perfume haul check Christmas holiday sales first.
ReplyDeleteIf you are shopping for cozy and elegant clothes this holiday season Le Lis Clothing has some great options Their pieces are versatile and easy to style The Christmas sale makes the pricing even better Give them a look
ReplyDeleteThanks for sharing such insightful content. The first time I learned how to eat a dragonfruit was during a holiday event and it became my favorite snack. Removing the skin and slicing the flesh into cubes makes it ideal for festive fruit platters. If anyone is shopping this Christmas sale check the markets for dragonfruit deals because it tastes amazing and makes gifts memorable.
ReplyDeleteWhen talking winter wardrobe essentials the denim tears hoodie offers more personality than typical basics. The craftsmanship adds story and meaning to the piece. I like how it pairs with both joggers and distressed jeans. If you’re shopping Christmas sales, this is one to consider.
ReplyDeleteBeen following Godspeed Clothing for a while now, and they keep improving. The drops are consistent, and the styling is unique without being over-the-top. Perfect for anyone who likes fashion with personality.
ReplyDeleteI love how Corteiz designs feel authentic, like they’re made for people who actually love streetwear. The details on their jackets and hoodies show they put thought into every release. Solid brand!
ReplyDeleteThis hoodie from Alchemai has been trending on my feed all week. The oversized fit and minimalistic design make it super appealing. Great to see new brands stepping up in the streetwear scene.
ReplyDeleteZawsze, kiedy widzę coś od Trapstar, wiem, że to będzie mocny projekt. Marka świetnie rozumie potrzeby fanów mody ulicznej.
ReplyDeleteReally enjoyed reading this! I’ve personally tried a few items from Asaali clothing, and the quality genuinely surprised me. Great option for people who want stylish wear without overspending.
ReplyDeleteJust checked out the Pink Palm Puff Store and I’m honestly surprised at how affordable their trendy pieces are. It’s rare to see such stylish items at prices that don’t break the bank.
ReplyDeleteThanks for sharing this! I’ve personally bought reps clothing a few times and was surprised at how comfortable the materials were. Some stores really put effort into stitching and packaging, making the experience feel premium even at a lower price.
ReplyDeleteBroken Planet has been gaining popularity for its creative approach to everyday wear. The hoodies especially caught my eye — they look cozy yet stylish. Anyone looking for modern streetwear with personality should take a look at their latest drops.
ReplyDeleteOnline shopping offers endless choices, and the ability to read customer reviews before buying makes it even more reliable. Whether it’s fashion, gadgets, or home essentials, everything is just a click away. Great time to shop smart and save more.
ReplyDelete