• pcroadkill
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
I have a java program that gets data from or BI system and then either merges the data with an existing salesforce account record or creates a new one. When I submit the upsert call using the Id as the key, my expectation was that the records that contain an Id will be updated and the ones that don't, will be created. It seems that it always creates new records therefore creating duplicates.

I have read that the upsert api doc and refers to an externalId, but I have not found anything that states how to use the actual Object id as the key. In the REST api doc and DML guides say to leave the key blank and it will use the object id, but in the SOAP API I don't seem to be able to do that.

Any help will bre greatly appreciated.
I am trying to submit a Case using the java API. When I try to save it, I get the following error:

Record Type ID: this ID value isn't valid for the user: 012E000000023tjIAA

Yet when I query the RecordType with SELECT ID, isactive FROM RecordType where sobjecttype = 'Case' and developername='Complaint_Case' and isactive = true it returns me the following:

true 012E000000023tjIAA.

Stepping through the code, I made sure that the correct id is being returns and it is.

What am I missing? Any insight will be greatly appreciated.


I am trying to deploy a new trigger and can't because the test below is failing. It is failing with the following error:

 

16:04:51.566 (566509000)|EXCEPTION_THROWN|[37]|System.DmlException: ConvertLead failed. First exception on row 0; first error: INVALID_STATUS, invalid convertedStatus: Qualified: []

 

Yet when I run the query specified in teh following line:

 

LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted = true LIMIT 1];

 

The status returned is 'Qualified' which is a valid status. Could anyone shed light on what may be going on... Thank you in advance.

 

private class TestPopulateCloseDateOnOppOnLeadConvert {

static testMethod void PopulateCloseDateOnOppOnLeadConversion() {

//Create
Lead lead = new Lead(LastName='Test', Company='Test', Business_Unit__c='EPS', CurrencyISOCode='USD', Status='Unqualified');
insert lead;

//Invoke
test.startTest();
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(lead.Id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted = true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
system.assert(lcr.isSuccess());
test.stopTest();

//Check
id oppId = lcr.getOpportunityId();
Opportunity opp = [SELECT Id, CloseDate FROM Opportunity WHERE Id = :oppId];
system.assertEquals(system.today().addDays(3), opp.CloseDate);

}
}