You need to sign in to do that
Don't have an account?
Anoop Patel 24
Invalid integer: common.apex.runtime.impl.SObjectList@c21a4303
I'm trying to count the number of accounts a user owns as well as stamping the last login date in a custom field within the same class but I'm receiving the error below on my scheduled class.
Invalid integer: common.apex.runtime.impl.SObjectList@c21a4303
My class...
global class LoginDateClass implements Schedulable{
global void execute(SchedulableContext SC){
list<user> userList = [SELECT Id,Total_Number_of_Accounts__c,LastLoginDate FROM User WHERE IsActive = TRUE LIMIT 9999];
LIST<AggregateResult> NoOfAccounts = [SELECT OwnerId u, count(Id) a FROM Account WHERE CoreAccounts__Inactive__c = FALSE AND OwnerId in :userList GROUP BY OwnerId];
for(User user : userList){
user.Last_Login__c = user.LastLoginDate;
user.Total_Number_of_Accounts__c = integer.valueOf(NoOfAccounts);
}
update userList;
}
}
Invalid integer: common.apex.runtime.impl.SObjectList@c21a4303
My class...
global class LoginDateClass implements Schedulable{
global void execute(SchedulableContext SC){
list<user> userList = [SELECT Id,Total_Number_of_Accounts__c,LastLoginDate FROM User WHERE IsActive = TRUE LIMIT 9999];
LIST<AggregateResult> NoOfAccounts = [SELECT OwnerId u, count(Id) a FROM Account WHERE CoreAccounts__Inactive__c = FALSE AND OwnerId in :userList GROUP BY OwnerId];
for(User user : userList){
user.Last_Login__c = user.LastLoginDate;
user.Total_Number_of_Accounts__c = integer.valueOf(NoOfAccounts);
}
update userList;
}
}
All Answers
{
null = (),
0018E00000e7d0FQAQ = (Required_Document__c: {
Name = Secondary Guardian Identity Documents,
Status__c = Verified,
Related_Party__c = 0018E00000e7d0FQAQ,
Document_Type__c = a2b8E000000Xn8oQAC,
Id = a2g8E000000Tbs9QAC
}, Required_Document__c: {
Name = Primary Guardian Identity Documents,
Status__c = Required,
Related_Party__c = 0018E00000e7d0FQAQ,
Document_Type__c = a2b8E000000Xn8pQAC,
Id = a2g8E000000TdlqQAC
}, Required_Document__c: {
Name = Proof of residence for the primary caregiver,
Status__c = Required,
Related_Party__c = 0018E00000e7d0FQAQ,
Document_Type__c = a2b8E000000Xn8uQAC,
Id = a2g8E000000TdlrQAC
}),
0018E00000f8JvIQAU = (),
0018E00000f8JvgQAE = (Required_Document__c: {
Name = Primary Guardian Identity Documents,
Status__c = Required,
Related_Party__c = 0018E00000f8JvgQAE,
Document_Type__c = a2b8E000000Xn8pQAC,
Id = a2g8E000000TdlvQAC
}, Required_Document__c: {
Name = Proof of residence for the primary caregiver,
Status__c = Required,
Related_Party__c = 0018E00000f8JvgQAE,
Document_Type__c = a2b8E000000Xn8uQAC,
Id = a2g8E000000TdlwQAC
}),
0018E00000f8K3KQAU = ()
}
But on the page if i print the map i get:
{
0018E00000f8JvIQAU = common.apex.runtime.impl.SObjectList @ 1,
null = common.apex.runtime.impl.SObjectList @ 1,
0018E00000e7d0FQAQ = common.apex.runtime.impl.SObjectList @ cf1961b0,
0018E00000f8JvgQAE = common.apex.runtime.impl.SObjectList @ 722da41e,
0018E00000f8K3KQAU = common.apex.runtime.impl.SObjectList @ 1
}
What was the solution that you used? and would it work for my case?