You need to sign in to do that
Don't have an account?
INACTIVE_OWNER_OR_USER. operation performed with inactive user.
Hi everyone ,
Im an apex noob, and have just started a position in a company that uses salesforce for its CRM, Unfortunately my predecessor left without handing over the salesforce reigns and I have been tasked with trying to change an email address in the code. However when i change the address and try to reupload the code, it goes to the sandbox without any problems, however when it goes to the production server I get the message that there is a system Dml exception due to an inactive owner or user. I have checked salesforce for the status of those that wrote the original code and they are all down as active ( despite being no longer with the company ).. The error seams to come in the testing code.
I would like to teach myself salesforce development however this one error is a giant brick wall to me. I have posted the code below, can anybody give me some pointers in how to overcome this.
@isTest private class vf_testing { static testMethod void myUnitTestofmultiple() { // TO DO: implement unit test caserefs igor = new caserefs(); igor.caser='123'; igor.poster='456'; } static testMethod void testingextra_dates(){ Account Fred = new Account(LastName='Flintstoned'); insert Fred; ID whom=Fred.Id; Account kgm = new Account(Name='KGM'); insert kgm; ID insurer=kgm.id; Opportunity Barney = new Opportunity(Name='Flintstoned', AccountId=whom, Insurer_prefix__c='KGM', Insurer__c=insurer, Case_referral_type__c='Unrecovered Theft', Business_Unit__c='Motor', Claim_Ref__c='430640', StageName='Claims Support', Date_of_Loss__c=date.today(), CloseDate=date.today()); insert Barney; Opportunity rei =[select id, name, estimatediscovery__c, account.personmailingstreet, account.PersonMailingCity, account.personmailingstate, account.personmailingpostalcode, Insurer_prefix__c, insurer__c, Case_referral_type__c, Business_Unit__c, case_file_long_reference__c, StageName, Date_of_Loss__c, AccountId from opportunity where id=:barney.id]; system.debug(rei.case_file_long_reference__c); ApexPages.StandardController pebbles=new ApexPages.StandardController(rei); extra_dates_opp bambam = new extra_dates_opp(pebbles); bambam.setappDriskAddr(false); bambam.setappDstreet('Street name'); String name=bambam.getappDstreet(); bambam.setappDcity('Street name'); name=bambam.getappDcity(); bambam.setappDcounty('Street name'); name=bambam.getappDcounty(); bambam.setappDpostcode('Street name'); name=bambam.getappDpostcode(); bambam.setappDuk('Street name'); name=bambam.getappDuk(); boolean isaddr=bambam.getappDriskaddr(); bambam.setappDriskAddr(true); name=bambam.getappDstreet(); name=bambam.getappDcity(); name=bambam.getappDcounty(); name=bambam.getappDpostcode(); bambam.setappDstreet('Street name'); bambam.setappDcity('Street name'); bambam.setappDcounty('Street name'); bambam.setappDpostcode('Street name'); bambam.setappDcircs('Event'); name=bambam.getappDcircs(); name=bambam.getincidentwords(); bambam.setincidentwords('incidentwords'); name=bambam.getHTMLinfo(); PageReference bexbex=bambam.PDFHH14(); name=bambam.getapprox(); name=bambam.getlongdate(); name=bambam.getlossdate(); bambam.nullme(); PageReference nowhere=bambam.pdfme(); name=bambam.getInsDial(); name=bambam.getInsFormal(); name=bambam.chooseInsName('EC'); name=bambam.Choose0845('EC'); name=bambam.chooseInsName('KG'); name=bambam.Choose0845('KG'); name=bambam.chooseInsName('MG'); name=bambam.Choose0845('MG'); name=bambam.chooseInsName('EI'); name=bambam.Choose0845('EI'); name=bambam.chooseInsName('CS'); name=bambam.Choose0845('CS'); name=bambam.chooseInsName('HS'); name=bambam.Choose0845('HS'); name=bambam.chooseInsName('RS'); name=bambam.Choose0845('RS'); name=bambam.chooseInsName('EQ'); name=bambam.Choose0845('EQ'); name=bambam.ChooseInsName('EM'); name=bambam.Choose0845('EM'); name=bambam.chooseInsName('HT'); name=bambam.Choose0845('HT'); name=bambam.Choose0845('EP'); name=bambam.chooseInsName('XX'); name=bambam.Choose0845('XX'); name=bambam.gettype_of_incident(); name=bambam.gettype_of_hhincident(); name=bambam.incwords('MAD'); name=bambam.incwords('SANE'); name=bambam.hhincwords('HAL'); name=bambam.hhincwords('HAD'); name=bambam.hhincwords('HUM'); } static testMethod void testingmulti_insert(){ Account Fred = new Account(LastName='Flintstoned'); insert Fred; ID whom=Fred.Id; Account kgm = new Account(Name='KGM'); insert kgm; ID insurer=kgm.id; Opportunity Barney = new Opportunity(Name='Flintstoned', AccountId=whom, Insurer_prefix__c='KGM', Insurer__c=insurer, Case_referral_type__c='Unrecovered Theft', Claim_Ref__c='430640', StageName='Claims Support', Date_of_Loss__c=date.today(), CloseDate=date.today()); insert Barney; String caseref=Barney.Claim_Ref__c; system.debug(caseref); system.debug(Barney.Case_file_long_reference__c); multi_insert pile=new multi_insert(); RecordTypeListCon types=new RecordTypeListCon(); types.sObjectType='Account'; List<SelectOption> screed=pile.gettypes(); screed=types.getItems(); pile.setSubject('Subjective'); String subj=pile.getSubject(); PageReference nowhere=pile.cancel(); boolean tick=pile.getDocreturns(); pile.setDocreturns(tick); pile.addrow(); pile.removerow(); pile.cases[0].caser=caseref; pile.cases[0].docser=true; pile.docReturns=true; pile.save(); pile.savepost(); pile.saveemail(); pile.clearout(); //Split here as the SOQL count is getting high. } static testMethod void testingmulti_insert2(){ Account Fred = new Account(LastName='Flintstoned'); insert Fred; ID whom=Fred.Id; Account kgm = new Account(Name='KGM'); insert kgm; ID insurer=kgm.id; Opportunity Barney = new Opportunity(Name='Flintstoned', AccountId=whom, Insurer_prefix__c='KGM', Insurer__c=insurer, Case_referral_type__c='Unrecovered Theft', Claim_Ref__c='430640', StageName='Claims Support', Date_of_Loss__c=date.today(), CloseDate=date.today()); insert Barney; String caseref=Barney.Claim_Ref__c; system.debug(caseref); system.debug(Barney.Case_file_long_reference__c); multi_insert pile=new multi_insert(); pile.cases[0].caser='bogus'; pile.save(); pile.cases[0].caser='430640'; pile.setSubject('Documents Received'); pile.save(); pile.outg(); pile.setSubject('1st Class Post'); pile.redticket=true; pile.outg(); pile.setSubject('2nd Class Post'); pile.outg(); pile.setSubject('1st Class Packet'); pile.outg(); pile.numitems=1; pile.totalcost=10.0; pile.docReturns=true; pile.outg(); } }
It seams to bounce its issue against
testingmulti_insert
SystemDmlException:Insert failed: First exception on row 1; first error:INACTIVE_OWNER_OR_USER. operation performed with inactive user.
Class.multi_insert.saveemail:line 176, column 1
Any help would be greatly and desperately appreciated
:)
Note : even if i change nothing and trying to send it back to the server I get the same error.
maybe this post could help you to locate the error: http://stackoverflow.com/questions/9317174/what-are-the-causes-of-a-operation-performed-with-inactive-user-error-when-cr
Cheers!
Hmm, I actually do think the issue is stemming from the multi_insert class. Can you post that as well?
heres the Multi_insert class as requested
Thanks again ...
This is sort of a shot in the dark here, but try adding OwnerId = UserInfo.getUserId() to all the Opportunity declarations in the test class... For example:
Opportunity Barney = new Opportunity(Name='Flintstoned', AccountId=whom, OwnerId = UserInfo.getUserId(), Insurer_prefix__c='KGM', Insurer__c=insurer, Case_referral_type__c='Unrecovered Theft', Business_Unit__c='Motor', Claim_Ref__c='430640', StageName='Claims Support', Date_of_Loss__c=date.today(), CloseDate=date.today());
having same issue while doing inserting on custom object.. ownerId of the custom object is set to Event object's ownerId before insert. this issue is happening rarely
I was duplicating attachments, and ran into this - Of course they don't give an offending field :(
Just an obvious extension - This error can affect any sObject where there is a user reference besides the ones SalesForce manages, e.g. OwnerId on Attachment is affected, while CreatedById and LastModifiedById are not affected.