• ShekharGawali
  • NEWBIE
  • 15 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,

My requirement is to show logged in users all the articles published after their respective last login date.
Since, the last login date is updated as soon as user logs in, I'm unable to get the date prior to that.
I tried using LoginHistory object, but for running soql on LoginHistory object, "Manage Users" permission is required. Since this permission can not be provided to all the users, this can not be considered as option.
Please find the code below:
//CurrentLoginTime as user is already logged in
DateTime currentLogin = [SELECT LastLoginDate FROM User WHERE Id =:UserInfo.getUserId()].LastLoginDate ; 
//Any prior login time before the current login time
DateTime lastLogin = [select loginTime from LoginHistory where userId = :UserInfo.getUserId() and loginTime != :currentLogin order by LoginTime Desc limit 1].loginTime;
I have also tried to make the class "without sharing", it throws an exception.
Many thanks in advance for the help.

Regards,
Shekhar
 
Hi,

My requirement is to show logged in users all the articles published after their respective last login date.
Since, the last login date is updated as soon as user logs in, I'm unable to get the date prior to that.
I tried using LoginHistory object, but for running soql on LoginHistory object, "Manage Users" permission is required. Since this permission can not be provided to all the users, this can not be considered as option.
Please find the code below:
//CurrentLoginTime as user is already logged in
DateTime currentLogin = [SELECT LastLoginDate FROM User WHERE Id =:UserInfo.getUserId()].LastLoginDate ; 
//Any prior login time before the current login time
DateTime lastLogin = [select loginTime from LoginHistory where userId = :UserInfo.getUserId() and loginTime != :currentLogin order by LoginTime Desc limit 1].loginTime;
I have also tried to make the class "without sharing", it throws an exception.
Many thanks in advance for the help.

Regards,
Shekhar
 
My answer is C... What do you think please ?

The marketing team at UC wants to send an email to each lead received from its website. The country of the incoming lead should determine the language of the email that will be sent to the lead.
How can a system admin automate this process?
a. Create an email template for each language and an assignment rule to send the appropriate template.
b. Create a single email template and use the translation workbench to translate and send the appropriate template..
c. Create an email template for each language and an auto-response rule to send the appropriate template.
d. Create an email template for each language and a workflow alert to send the appropriate template.
  • August 25, 2015
  • Like
  • 1
I have to make it impossible to edit the Email field UNLESS the field is blank.

I tried the following Validation but it didn't work:
Email <> ""
&&
ISBLANK( Email )

Any suggestions as to why?