I have two kind of user in my portal, a customer user and an agent user. I want to change the default Homepage of Agent user every time he/she logs in or clicks to a Homepage button to the website instead of the customer's default homepage.ie (Agent Homepage) Currently, I was able to achieve this through below code:
var userId = AuthenticationManager.AuthenticationResponseGrant.Identity.GetUserId();
var user = await UserManager.FindByIdAsync(userId);
var portal = PortalCrmConfigurationManager.CreatePortalContext();
var usercontext = portal.User;
var context = portal.ServiceContext;
var contact = (from c in context.CreateQuery("contact")
where c["contactid"].Equals(userId)
select c).First();
var isAgentUser = contact.GetAttributeValue<bool>("bh_isagentuser");
if (isAgentUser == true)
{
return Redirect("/agent-home");
}
else
{
return RedirectToLocal(returnUrl);
}
I want to know if there's another workaround for ADX studio to achieve this?