• pearlbear
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi there,

 

I'm trying to do a child to parent query from a standard to a custom object. 

 

I've tried: 

SELECT Contact.npo02__Household__c.Household_Salutation_1__c FROM Contact WHERE Contact.Id = :conID

 

But it's throwing this error:

 

 Didn't understand relationship 'npo02__Household__c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.

 

I have also tried:

SELECT npo02__Contacts__r.Household_Salutation_1__c FROM Contact WHERE Contact.Id = :conID

 

And I get this error: 

Didn't understand relationship 'npo02__Contacts__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.

 

So I'm stuck. Suggestions?

I've got a test class for a trigger, and I'm running into trouble. First issue: I'm running into an error I can't figure out:

 

The trigger is for a new opportunity created from a contact record. The trigger is "After Insert" so it's possible to grab a contact id from the OpportunityContactRole record created.

 

This trigger works great in the sandbox. If the contact has an email, one is sent, if not, a new task is created.

 

Here's the test class so far:

 

 

public class testEmailTrigger {
	//This class is simply to test the SendEmailTrigger trigger
	
	//Test Method
	static testMethod void testEmail() {
		//Insert a record into the right table to test
		//In this case, the table is Opportunity

		Opportunity o = new Opportunity ();
		o.Amount=100;
		o.CloseDate = System.Today();
		o.Description = 'TEST';
		o.Name = 'TEST';
		o.StageName = 'Closed Won';
		
		//Start the test
		test.startTest();
		insert o;
		test.stopTest();
	}

}

The error I'm getting is that it "CANNOT_INSERT_UPDATE_ACTIVITY_ENTITY" - I get a "list has no rows for assigment to sObject"

 

I'm also a bit at a loss as to how to get better test coverage for the trigger. It's a really simple trigger - query of the OpportunityContactRole for contact id, if there is one, send an email, if not, set a new task associated with that opportunity and contact.

 

Thanks for any guidance. The docs on testing are not very helpful.

Hi there, I've written a trigger that sends an email based upon a new opportunity. Trigger works great. Now for the test classes. I've got this test class:

public class testEmailTrigger {
	//This class is simply to test the SendEmailTrigger trigger
	
	//Test Method
	static testMethod void testEmail {
		//Insert a record into the right table to test
		//In this case, the table is Opportunity

		Opportunity o = new Opportunity ();
		o.Amount='100';
		o.CloseDate = System.Today();
		o.Description = 'TEST';
		
		//Start the test
		test.startTest();
		insert o;
		test.stopTest();
	}

}

It complains at the line "Opportunity o = new Opportunity(); with the error "unexpected token Opportunity." What am I doing wrong?

I'm writing a trigger, which, upon certain conditions, should write a new activity record connected to the Opportunity. I'm fairly new to Salesforce and APEX, so this is stumping me. I can figure out how to create a new sObject, and write records salesforce, etc. but the Activities object seems weird and special, and I can't quite puzzle out how to do this. Even URLs are welcome.

 

Thanks!

Hi there,

 

I'm trying to do a child to parent query from a standard to a custom object. 

 

I've tried: 

SELECT Contact.npo02__Household__c.Household_Salutation_1__c FROM Contact WHERE Contact.Id = :conID

 

But it's throwing this error:

 

 Didn't understand relationship 'npo02__Household__c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.

 

I have also tried:

SELECT npo02__Contacts__r.Household_Salutation_1__c FROM Contact WHERE Contact.Id = :conID

 

And I get this error: 

Didn't understand relationship 'npo02__Contacts__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.

 

So I'm stuck. Suggestions?

Hi,

 

I am new with Apex and, I was wondering if anyone can tell me what is wrong with the following code:

 

I was trying to compare the zip codes in the myset set with the BillingPostalCode of the account records.  Even though the code didn't give any errors, when I run it,  I get "maximum trigger depth exceeded" error. I guess  there is a problem with the loop and it is trying to run the same line over an over. 

 

 

trigger testtrigger on Account (After Insert, after update) {

Set<String> myset = new Set<String>{'87543','08502', '07541'}; 



String s = 'Tester'; 


for (Account accs : [select id, name,BillingPostalCode from account where BillingPostalCode in :myset]){ 
  


accs.Name = 'test successful';

update accs;

       }
    
}

 

Help will be  really appreciated.

Thanks!

 

I've got a test class for a trigger, and I'm running into trouble. First issue: I'm running into an error I can't figure out:

 

The trigger is for a new opportunity created from a contact record. The trigger is "After Insert" so it's possible to grab a contact id from the OpportunityContactRole record created.

 

This trigger works great in the sandbox. If the contact has an email, one is sent, if not, a new task is created.

 

Here's the test class so far:

 

 

public class testEmailTrigger {
	//This class is simply to test the SendEmailTrigger trigger
	
	//Test Method
	static testMethod void testEmail() {
		//Insert a record into the right table to test
		//In this case, the table is Opportunity

		Opportunity o = new Opportunity ();
		o.Amount=100;
		o.CloseDate = System.Today();
		o.Description = 'TEST';
		o.Name = 'TEST';
		o.StageName = 'Closed Won';
		
		//Start the test
		test.startTest();
		insert o;
		test.stopTest();
	}

}

The error I'm getting is that it "CANNOT_INSERT_UPDATE_ACTIVITY_ENTITY" - I get a "list has no rows for assigment to sObject"

 

I'm also a bit at a loss as to how to get better test coverage for the trigger. It's a really simple trigger - query of the OpportunityContactRole for contact id, if there is one, send an email, if not, set a new task associated with that opportunity and contact.

 

Thanks for any guidance. The docs on testing are not very helpful.

Hi there, I've written a trigger that sends an email based upon a new opportunity. Trigger works great. Now for the test classes. I've got this test class:

public class testEmailTrigger {
	//This class is simply to test the SendEmailTrigger trigger
	
	//Test Method
	static testMethod void testEmail {
		//Insert a record into the right table to test
		//In this case, the table is Opportunity

		Opportunity o = new Opportunity ();
		o.Amount='100';
		o.CloseDate = System.Today();
		o.Description = 'TEST';
		
		//Start the test
		test.startTest();
		insert o;
		test.stopTest();
	}

}

It complains at the line "Opportunity o = new Opportunity(); with the error "unexpected token Opportunity." What am I doing wrong?

Hello!  Does anyone have recommendations for an already established platform that allows for both case management (i.e.. Human Services Salesforce Platform) and donor development (i.e.. Nonprofit Starter Pack)?  I am currently on the Nonprofit Starter Pack trial but it lacks the functionality to manage our caseload of clients, track outcomes, treatment plans, etc.  It would be great to have a program that allows for both OR have a Human Services app that can be loaded onto the Nonprofit Starter Pack or vice versa.

 

Thanks!

I'm writing a trigger, which, upon certain conditions, should write a new activity record connected to the Opportunity. I'm fairly new to Salesforce and APEX, so this is stumping me. I can figure out how to create a new sObject, and write records salesforce, etc. but the Activities object seems weird and special, and I can't quite puzzle out how to do this. Even URLs are welcome.

 

Thanks!