-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
1Replies
Help with test script for the first apex trigger I have build
Hello,
I have written my first apex trigger, but I didn't know that I also need a test script before i can implement it. I'm very new to this so i'm wondering if someone could help me with the test script:
The trigger is as followed:
trigger setPriceBook on Opportunity (before insert, before update) { ID PRICEBOOK_FRAMEWORK = '01sR00000000EtRIAU'; ID PRICEBOOK_PROJECTEN_AO_LICENTIES = '01sR00000000EtWIAU'; ID REC_TYPE_FRAMEWORK = '012R00000004Ykf'; ID REC_TYPE_PROJECTEN_AO_LICENTIES = '012R00000004Ykk'; for( Opportunity oppty : trigger.new ) { if ( oppty.type == 'Framework Agreement') { oppty.Pricebook2Id = PRICEBOOK_FRAMEWORK; } else if ( oppty.type == 'Projecten') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } else if ( oppty.type == 'Application Outsourcing') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } else if ( oppty.type == 'licenties') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } } }
Can someone help me with the test script?
With kind regards,
Christiaan
-
- Christiaan
- August 13, 2009
- Like
- 0
- Continue reading or reply
Custom object where only the last record per account is shown in a report
I have implemented a custom object Customer Satisfaction research that is a related list of accounts. In this object the results of the satisfaction interviews are stored.
In a year multiple customer satisfaction researches can be conducted for multiple accounts. For an example see below:
Account A:
record 1 of customer satisfaction research - research 1
record 2 of customer satisfaction research - research 2
record 3 of customer satisfaction research - research 3
Account B:
Record 1 of customer satisfaction research - research 1
Record 2 of customer satisfaction research - research 2
Account C:
Record 1 of customer satisfaction research - research 1
In a report i want only the last research per account to be shown, so following the example:
Record 3 of Account A
Record 2 of Account B
Record 1 of Account C
Is there way (or in the object, or in the criteria of the report) to make sure that only the last record per account is shown in a report?
Salesforce premier support couldn't figure out a way to do it, so i hope someone on the discussion board can help me.
With kind regards,
Christiaan Veldkamp
-
- Christiaan
- August 11, 2009
- Like
- 0
- Continue reading or reply
Change the 'button' Copy Mailing Address to Other Address at the contacts object
Hello,
Is it possible to change the contacts button Copy Mailing Address to Other Address at the contact object. I would like to change it so that with that button the Other Address of the Account to who the new contact is connected is copied instead of the Mailing address of the contact.
If its possible, how can i manage it?
With kind regards,
Christiaan
-
- Christiaan
- August 06, 2009
- Like
- 0
- Continue reading or reply
Is it possible to make a custom object 'Relationship' dependent on the standard Object Contacts?
Hello,
I have a question about using custom objects.
I Want to implement a custom object "relationship" that will be added as a related list in the Contacts page layout. Is it possible to set the rights of the custom object "relationship" in that way, that only the contact owner can add a relationship record for the contact person?
With kind regards,
Christiaan
-
- Christiaan
- August 06, 2009
- Like
- 0
- Continue reading or reply
Is it possible to make the price book dependent on the type of opportunity
I have activated the opportunity products (and 2 price books) in my sandbox environment and have activated "Prompt users to add products to opportunities"
After making a new Opportunity, in step 2 users have to select a pricebook before products can be added to the opportunity.
In our situation the two price books (professionals Services and projects) are dependent on the type of Opportunity: (professional Services and project). It would be very user friendly if the price book automaticly would be chosen dependent of the opportunity type that is filled in at the new Opportunity (professional services and projects).
At this moment users have to fill in what type of opportunity it is, but again have to select what pricebook belongs to that opportunity type. That's not ideal.
Is there a solution to automate this?
-
- Christiaan
- July 14, 2009
- Like
- 0
- Continue reading or reply
Is it possible to make the price book dependent on the type of opportunity
I have activated the opportunity products (and 2 price books) in my sandbox environment and have activated "Prompt users to add products to opportunities"
After making a new Opportunity, in step 2 users have to select a pricebook before products can be added to the opportunity.
In our situation the two price books (professionals Services and projects) are dependent on the type of Opportunity: (professional Services and project). It would be very user friendly if the price book automaticly would be chosen dependent of the opportunity type that is filled in at the new Opportunity (professional services and projects).
At this moment users have to fill in what type of opportunity it is, but again have to select what pricebook belongs to that opportunity type. That's not ideal.
Is there a solution to automate this?
- Christiaan
- July 14, 2009
- Like
- 0
- Continue reading or reply