• Becky Miller
  • NEWBIE
  • 10 Points
  • Member since 2015
  • System Administrator

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
I am trying to populate user.lastlogindate into the custom field in the User Object called date_last_login__c.  I am getting an error + loop did not match anything at input 'trigger'


trigger lastloginDate on User(before update) {
User u = [SELECT LastLoginDate FROM User WHERE Id =:UserInfo.getUserId()];
for(User b : Trigger.new){
u.date_last_login__c = b.LastLoginDate;
}
}

On a sidenote I am very very new at coding.  So, if you have a different way I should be doing this please change it up.  Thank you so much.
Does anyone have any code that creates the History of the Price Book Entries?  Or how do you handle when an end user wants to know what Changed and the Date it changed.  History of the Changes also.
 
I am trying to populate user.lastlogindate into the custom field in the User Object called date_last_login__c.  I am getting an error + loop did not match anything at input 'trigger'


trigger lastloginDate on User(before update) {
User u = [SELECT LastLoginDate FROM User WHERE Id =:UserInfo.getUserId()];
for(User b : Trigger.new){
u.date_last_login__c = b.LastLoginDate;
}
}

On a sidenote I am very very new at coding.  So, if you have a different way I should be doing this please change it up.  Thank you so much.
Does anyone have any code that creates the History of the Price Book Entries?  Or how do you handle when an end user wants to know what Changed and the Date it changed.  History of the Changes also.
 
Hi All,

we want to know how many days it takes from visiting the customer until the opportunity is closed.

We use events only for these visits, so every account only has one event. What I need to do is to copy the date of this event either to an opportunity or account to add another custom field to calculate the days between start date (I already cloned this field in the event to use it in formulas) and close date.
Another problem is, that CloseDate is only Date and not DateTime like my cloned StartDate. Any chance to calculate it anyway?

Thanks very much for your help!

Lukas

how to capture the last login date of a user into a custom field