You need to sign in to do that
Don't have an account?
Divaker Singh
can we query on deactivate user on customer portal in login time
I have a issue related to deactivate user
I have a field deactivate reason in user object
Deactivate User should be redirect on login in portal according to deactivate reason(new field on user) field
1.If deactivate reason is 'FCRA Renew' than user should be redirect on new screen.
2.if deactivate reason is Standard than standard Deactivated message “You access is disabled. Contact your site administrator”
should be display.
But when I am query on deactivate user than it is not return the deactivate reason value.
I have login button on customer portal and its return the site.login method.
Can we query on deactivate user on login time.
class code:
global class SiteLoginController {
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
List<User> lstUser = [Select IsActive, Deactivation_Reason__c from User Where Username=:username limit 1];
if(lstUser.size() > 0 ){
User oUser = lstUser.get(0);
if(oUser.IsActive == false && oUser.Deactivation_Reason__c.tolowercase().contains('fcra') ){
return Site.login(username, password, '/main/deactivateuser');
}
else{
return Site.login(username, password, '/home/home.jsp');
}
}
return Site.login(username, password, '/home/home.jsp');
}
global SiteLoginController () {}
}
Thanks
I have a field deactivate reason in user object
Deactivate User should be redirect on login in portal according to deactivate reason(new field on user) field
1.If deactivate reason is 'FCRA Renew' than user should be redirect on new screen.
2.if deactivate reason is Standard than standard Deactivated message “You access is disabled. Contact your site administrator”
should be display.
But when I am query on deactivate user than it is not return the deactivate reason value.
I have login button on customer portal and its return the site.login method.
Can we query on deactivate user on login time.
class code:
global class SiteLoginController {
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
List<User> lstUser = [Select IsActive, Deactivation_Reason__c from User Where Username=:username limit 1];
if(lstUser.size() > 0 ){
User oUser = lstUser.get(0);
if(oUser.IsActive == false && oUser.Deactivation_Reason__c.tolowercase().contains('fcra') ){
return Site.login(username, password, '/main/deactivateuser');
}
else{
return Site.login(username, password, '/home/home.jsp');
}
}
return Site.login(username, password, '/home/home.jsp');
}
global SiteLoginController () {}
}
Thanks
Could you check field level permission for the Deactivation_Reason__c for the guest profile user. You could verify the query by executing the query in Query Editor in developer console
I have given all permission.
yes we can query on query editor in console but when we use query in apex class and use on login button with condition(given in code) than unable to get the value of Deactivation_Reason__c.