• sfdcIs
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 22
    Replies

I noticed today that when I create a new project in eclipse I get this error:

 

Unable to fetch and save Force.com components to project:

 

com.salesforce.ide.api.metadata.types.Metadata@JaxAcessorF_fullName cannot be case to com.sun.xml.internal.binf.v2.reflect.Accessor

 

Anybody else getting this error?

  • November 11, 2012
  • Like
  • 0

I noticed today that when I create a new project in eclipse I get this error:

 

Unable to fetch and save Force.com components to project:

 

com.salesforce.ide.api.metadata.types.Metadata@JaxAcessorF_fullName cannot be case to com.sun.xml.internal.binf.v2.reflect.Accessor

 

Anybody else getting this error?

  • November 11, 2012
  • Like
  • 0

my acctMap value is an Account sObject.  I am trying to put the sObject from List<Account> aNewList which is the collection from Trigger.new into this acctMap. How can I do this? I tried with the get.sObjectType method but it's not working

 

acctsMap.put(aOldList.get(i).Id,aNewList.getSObjectType());

 

 

public static void updateContactOptOutSettings(List<Account> aNewList, List<Account> aOldList )
{
for(Integer i = 0; i < aNewList.size(); i++)
{
Map<Id, Account> acctsMap= new Map<Id, Account>();
if ( (aOldList.get(i).Email_Opt_Out__c != aNewList.get(i).Email_Opt_Out__c || aOldList.get(i).Email_Fax_Out__c != aNewList.get(i).Email_Fax_Out__c ||
aOldList.get(i).Do_Not_Call__c!= aNewList.get(i).Do_Not_Call__c ))
{
acctsMap.put(aOldList.get(i).Id,aNewList.getSObjectType());
}
}

  • October 11, 2012
  • Like
  • 0

This is my code stub that catches nullPointerException and I am trying to pass coverage on the 2nd test method testAccountTerritoryUpdateNegative() below.  I also know that I am not supposed to hardcode ID or Name in the test method but I will fix this later since I'm just trying to implement the test to see if it passes. How come the soql in my test method brings back zero rows? When I run that soql in the schema explorer, it brings back the record.  hmmmmmmm

 

System.QueryException: List has no rows for assignment to SObject

Class.AccountTests.testAccountTerritoryUpdateNegative: line 51, column 1

 

catch (System.NullPointerException e)
{
for(Account a: aList)
{
a.addError('There was an error with the record since a field was not populated correctly, please contact IT at 1888-888-8888 for asssitance, error number ' + e.getLineNumber());
}
}

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@isTest private static void testAccountTerritoryUpdateNegative()
{
Account testAccount =[select id, billingstreet from account where name = 'test compant'];
try
{
testAccount.BillingStreet ='test negative street';
Test.startTest();
update testAccount;
Test.stopTest();
}
catch(System.NullPointerException e)
{
System.assertEquals('NullPointerException' , e.getTypeName());
}

}

  • October 07, 2012
  • Like
  • 0

I am buldiing a test class with sObjects instantiated inside a test factory.  I have another accountTest class that passes parameters to the test class which successfully created my account with buildTestAccountPostive().  However, in my negative test, I want to be able to update this same account with and set the record type to null. First of all, will SFDC let me update a account.recordtypeId = null and is there a way I can insert an Account succesfully without any recordtypeID?

 

Second question if yes, when I try to reference the newAccount1 with  Account negAccountRec =[select id, recordtypeid from Account where ID IN: newAccount1];     i keep getting newAccount1 variable does not exist.  Notice Account buildTestAccountPostive() is not static

 

public Account buildTestAccountPostive(Integer i)
{
Account newAccount1 = new Account();
newAccount1.Name = 'Test' + i;
//RT is hard-coded temporarily ill update to use a collection instead later
newAccount1.recordtypeid= '012f0000000ChWYAA0';
return newAccount1;
}

 

public static Account updateTestAccountPositivetoNegative(Integer i)
{
Account negAccountRec =[select id, recordtypeid from Account where ID IN: newAccount1];
negAccountRec.recordtypeid = null;
return negAccountRec;
}

  • October 06, 2012
  • Like
  • 0

I am trying to compare the account recordtype name to the zone record type name from an Account sObject.  If it matches than further processing should be done.  I tried it this way but realzied the hard way that each object have their own record type id. What is the best way to match the record type name?

 

 

List<Zone__c> zList = [select recordtypeid from Zone_c];
List<RecordType> rtList = [select id, name from RecordType ];

 

for(Account a: aList)
{

if( a.recordtypeid ==zList.get(i).recordtypeid )
{

 

// some processing

 

}

  • October 04, 2012
  • Like
  • 0

I am trying to convert this contact sObject to a string to grab the first 5 characters of the zip and compare but keep getting an error of "method does not exist or incorrect signature. any ideas?

 

String bpc= String.valueOf(c.MailingPostalCode);

 

if(bpc.left(5)>= cList.get(i).zip)

{

 // more processing

}

  • October 03, 2012
  • Like
  • 0

I have a before insert and update trigger that updates the account.ownerid based on criteria that is met by matching the account.billing state to zone.state__c custom object. I created a try catch block to catch and exception and throw the error to a custom errorlog object.  But it doesn't  seem to catch it. Is this because a query exception is not considered a dml exception? alsoi have A method called getNumDMl(), does this method count all exceptions or just dml ones? I want to basically catch as many exceptions as possible and throw to error log. any advice would be great

 

catch (QueryException e)
{
Error_Log__c eLog = new Error_Log__c();
List<Error_Log__c> eLogList = new List<Error_Log__c>();
for (Integer iex = 0; iex < e.getNumDml(); iex++)
{
eLog.Description__c = e.getDmlMessage(iex);
eLogList.add(eLog);
}
insert eLogList;
}

  • September 29, 2012
  • Like
  • 0

my acctMap value is an Account sObject.  I am trying to put the sObject from List<Account> aNewList which is the collection from Trigger.new into this acctMap. How can I do this? I tried with the get.sObjectType method but it's not working

 

acctsMap.put(aOldList.get(i).Id,aNewList.getSObjectType());

 

 

public static void updateContactOptOutSettings(List<Account> aNewList, List<Account> aOldList )
{
for(Integer i = 0; i < aNewList.size(); i++)
{
Map<Id, Account> acctsMap= new Map<Id, Account>();
if ( (aOldList.get(i).Email_Opt_Out__c != aNewList.get(i).Email_Opt_Out__c || aOldList.get(i).Email_Fax_Out__c != aNewList.get(i).Email_Fax_Out__c ||
aOldList.get(i).Do_Not_Call__c!= aNewList.get(i).Do_Not_Call__c ))
{
acctsMap.put(aOldList.get(i).Id,aNewList.getSObjectType());
}
}

  • October 11, 2012
  • Like
  • 0

I am trying to compare the account recordtype name to the zone record type name from an Account sObject.  If it matches than further processing should be done.  I tried it this way but realzied the hard way that each object have their own record type id. What is the best way to match the record type name?

 

 

List<Zone__c> zList = [select recordtypeid from Zone_c];
List<RecordType> rtList = [select id, name from RecordType ];

 

for(Account a: aList)
{

if( a.recordtypeid ==zList.get(i).recordtypeid )
{

 

// some processing

 

}

  • October 04, 2012
  • Like
  • 0

I am trying to convert this contact sObject to a string to grab the first 5 characters of the zip and compare but keep getting an error of "method does not exist or incorrect signature. any ideas?

 

String bpc= String.valueOf(c.MailingPostalCode);

 

if(bpc.left(5)>= cList.get(i).zip)

{

 // more processing

}

  • October 03, 2012
  • Like
  • 0

I have a before insert and update trigger that updates the account.ownerid based on criteria that is met by matching the account.billing state to zone.state__c custom object. I created a try catch block to catch and exception and throw the error to a custom errorlog object.  But it doesn't  seem to catch it. Is this because a query exception is not considered a dml exception? alsoi have A method called getNumDMl(), does this method count all exceptions or just dml ones? I want to basically catch as many exceptions as possible and throw to error log. any advice would be great

 

catch (QueryException e)
{
Error_Log__c eLog = new Error_Log__c();
List<Error_Log__c> eLogList = new List<Error_Log__c>();
for (Integer iex = 0; iex < e.getNumDml(); iex++)
{
eLog.Description__c = e.getDmlMessage(iex);
eLogList.add(eLog);
}
insert eLogList;
}

  • September 29, 2012
  • Like
  • 0