Hi,
Once user sign in using local sign in or Azure AD, user must redirect to specific page.
Thanks @ragavanrajan
I have tried above code and it is working.
So, If I put below code in Home - Localized Content Web Page and it is working fine.
$( document ).ready(function() {
var userData = "{{user.id}}";
if(userData != undefined && userData != null && userData != "")
{
$(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');
}
});
If I put above code in Web Page directly, then it is not working. Is there any reason?
Hi @hardikv
Place the below code in your profile web page (Localised content > Custom JavaScript) or any web page depending on your business need.
$( document ).ready(function() {
console.log(555,"Redirect check");
$(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');
});
Done the testing. It is redirecting to contacts page in my case.
Hope it helps.
------------
If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Hi @ragavanrajan & @chleverenz
Thanks for your suggestion.
I have tried to modify Home Web Template and redirect to specific page. However it is not working as expected.
{% if user %}
<script>
window.location.href='./contact-us/'
</script>
{% else %}
<div class="wrapper-body">
<section class="page_section section-landing">
<div class="container">
<div class="row ">
<div class="col-md-12">
<br>
<br>
<br>
<br>
<h1 class="section-landing-heading">{% editable snippets 'Home/Title' type: 'text' %}</h1><br>
<h2 class="section-landing-sub-heading">{% editable page 'adx_summary' type: 'html', liquid: true %}</h2>
<br>
<br>
</div>
</div>
</div>
</section>
<section class="page_section">
<div class="layer_up"> </div>
<div class="container">
<div class="content-home">
{% include 'Page Copy' %}
</div>
</div>
<div class="layer_down"> </div>
</section>
<div class="push"></div>
</div>
{% endif %}
Hi @hardikv
The preferred and standard way is to change the liquid scripting in the Home web template.
The example below is redirecting to the "contact-us" page.
{% if user %}
//if any user logs in
<script>
window.location.href='./contact-us/'
</script>
{% else %}
//Home web page code, if you don't want to display the page when the user is being redirected
{% endif %}
//Home web page code, if you want to display the page when the user is being redirected
Hope it helps.
------------
If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Hi @hardikv ,
did you have a look on https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects#user ?
In fact if there is the need for a user-specific page you could look, whether you are on the home or profilepage or whatever and in case of logged in user navigate to a page, which is somehow user-dependent.
You could also look, whether your page referrer was the login. may be, this could help to identify, that you just logged in...
Hope i got the question right, have fun,
Christian
Hi @hardikv
Have a look at the below thread mate.
https://powerusers.microsoft.com/t5/Power-Apps-Portals/Redirect-after-T-amp-C/m-p/912659#M7102
Hope it helps.
------------
If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
WarrenBelz
146,765
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional