You need to sign in to do that
Don't have an account?
Ashwin sfdc 3
getting "invalid cross reference id" error on running the below code in test class .
getting "invalid cross reference id" error on running the below code in test class .
@isTest
public class TestForceForecasting {
static testMethod void insertNewUser() {
User userToCreate = new User();
userToCreate.FirstName = 'Davidsh';
userToCreate.LastName = 'Liush';
userToCreate.Email = 'dashwinsfdc99@gmail.com';
userToCreate.Username = 'sfdc-shdreamer@gmail.com';
userToCreate.Alias = 'fatty';
userToCreate.TimeZoneSidKey = 'GMT';
userToCreate.LocaleSidKey = 'en_US';
userToCreate.EmailEncodingKey = 'UTF-8';
userToCreate.LanguageLocaleKey = 'en_US';
userToCreate.ProfileId='00e28000005Mf8h';
insert userToCreate;
}
}
@isTest
public class TestForceForecasting {
static testMethod void insertNewUser() {
User userToCreate = new User();
userToCreate.FirstName = 'Davidsh';
userToCreate.LastName = 'Liush';
userToCreate.Email = 'dashwinsfdc99@gmail.com';
userToCreate.Username = 'sfdc-shdreamer@gmail.com';
userToCreate.Alias = 'fatty';
userToCreate.TimeZoneSidKey = 'GMT';
userToCreate.LocaleSidKey = 'en_US';
userToCreate.EmailEncodingKey = 'UTF-8';
userToCreate.LanguageLocaleKey = 'en_US';
userToCreate.ProfileId='00e28000005Mf8h';
insert userToCreate;
}
}
Arkadiy Golovko
So, I just wanted everyone to know that I struggled with the "invalid cross reference ID" error too when trying to update users. The error was on each line of the list so it was impossible to determine if it was one record or all of the records. When I re-exported the list (from the test sandbox this time instead of Production) I was able to do the upload. There were 5 records in the Production environment that were not in the sandbox. It would have been difficult to figure out which records on the list of over 800 that were causing the error.
Amit Chaudhary 8
Always try to avoid the hardcoding . Try to update your code like below