I have added a custom field of type String to the User standard object. I'm trying to update it from a controller but even though I see the update succeeds in the Debug Log the value is not actually changing in the DB.
Any suggestions what is wrong?
This is the method (it is called from a getter method of one the class's members:
public static void updateLastVisited(Date dt){
User usr;
try{
usr = new User(Id=UserInfo.getUserId(), Portfolio_Catalog_Last_Visit__c=dt.format());
update usr;
}
catch(DMLException e){
system.debug(LoggingLevel.WARN, e);
}
}
This is the debug log snippet:
22:50:26.407 (407350000)|METHOD_ENTRY|[65]|01pd00000022nbS|PortfolioCatalogController.updateLastVisited(Date) 22:50:26.407 (407365000)|VARIABLE_SCOPE_BEGIN|[757]|dt|Date|false|false 22:50:26.407 (407405000)|VARIABLE_ASSIGNMENT|[757]|dt|"2013-01-08T00:00:00.000Z" 22:50:26.407 (407417000)|HEAP_ALLOCATE|[758]|Bytes:5 22:50:26.407 (407426000)|STATEMENT_EXECUTE|[757] 22:50:26.407 (407430000)|STATEMENT_EXECUTE|[758] 22:50:26.407 (407439000)|VARIABLE_SCOPE_BEGIN|[758]|usr|User|true|false 22:50:26.407 (407448000)|VARIABLE_ASSIGNMENT|[758]|usr|null| 22:50:26.407 (407453000)|STATEMENT_EXECUTE|[759] 22:50:26.407 (407457000)|STATEMENT_EXECUTE|[759] 22:50:26.407 (407460000)|STATEMENT_EXECUTE|[760] 22:50:26.407 (407473000)|HEAP_ALLOCATE|[760]|Bytes:4 22:50:26.407 (407583000)|SYSTEM_METHOD_ENTRY|[760]|system.UserInfo.getUserId() 22:50:26.407 (407625000)|SYSTEM_METHOD_EXIT|[760]|system.UserInfo.getUserId() 22:50:26.407 (407689000)|VARIABLE_ASSIGNMENT|[760]|this.Id|"005d0000001KWYeAAO"|0xcd1e78c 22:50:26.407 (407719000)|SYSTEM_METHOD_ENTRY|[760]|Date.format() 22:50:26.407 (407773000)|HEAP_ALLOCATE|[760]|Bytes:8 22:50:26.407 (407785000)|SYSTEM_METHOD_EXIT|[760]|Date.format() 22:50:26.407 (407818000)|VARIABLE_ASSIGNMENT|[760]|this.Portfolio_Catalog_Last_Visit__c|"1/8/2013"|0xcd1e78c 22:50:26.407 (407866000)|VARIABLE_ASSIGNMENT|[760]|usr|{"Id":"005d0000001KWYeAAO","Portfolio_Catalog_La (11 more) ...":"1/8/2013"}|0xcd1e78c 22:50:26.407 (407875000)|STATEMENT_EXECUTE|[762] 22:50:26.407 (407901000)|HEAP_ALLOCATE|[762]|Bytes:8 22:50:26.407 (407911000)|DML_BEGIN|[762]|Op:Update|Type:User|Rows:1 22:50:26.407 (407927000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8 22:50:26.470 (470058000)|DML_END|[762] 22:50:26.470 (470093000)|METHOD_EXIT|[65]|01pd00000022nbS|PortfolioCatalogController.updateLastVisited(Date) 22:50:26.470 (470103000)|STATEMENT_EXECUTE|[71] 22:50:26.470 (470127000)|CODE_UNIT_FINISHED|lastVisited