• Janice Hu
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hi, I am trying to create a trigger that will create child objects withing a custom object that are mapped to another object in the same opportunity.

For example, there is revenue $10K that is uploaded to custom object "Actuals" of an opportunity. Whenever revenue is uploaded, I want to create a child object or objects for each split partner of the opportunity. For example, if there are 2 split partners, then I would like 2 child objects to be created under that "Actuals" custom object and to calculate the amount of revenue that should go to each person. If it is split 50% each, then a child object will be created for person A with $5K and another child object created for person B with $5K. This happens each time a new "Actuals" is uploaded.

Could someone let me know if this is possible? If you have any suggestions for the code, that is appreciated. Thank you!!

I think it has to do with my Apex test classes - I tried to change some classes from "private" to "public" but the classes wouldn't save and just show this error instead. (I am going through Apex Academy on pluralsight, so this is the example from there - the suggested method was "private class" in line 2, but it still gives me the error when I try to save it as "public class".
 
@isTest
private class LeadingCompetitorTest {
    
    @isTest static void createOppWithCompetitors() {
        // Create an opportunity and set required fields
        Opportunity opp = new Opportunity();
        opp.Name        = 'Big Deal';
        opp.CloseDate   = Date.today();
        opp.StageName   = 'Prospecting';

        // Set competitor price fields
        opp.Competitor_1_Price__c = 5000;
        opp.Competitor_2_Price__c = 15000;
        opp.Competitor_3_Price__c = 25000;

        // Set competitor fields
        opp.Competitor_1__c = 'Amazon';
        opp.Competitor_2__c = 'Google';
        opp.Competitor_3__c = 'Microsoft';

        insert opp;
        System.debug('Opportunity ' + opp.Name + ' inserted with all comeptitor fields populated.');

    }
}
Hello!

I am extrememly new to coding and am attempting to write a simple code to update a checkbox field to checked on the Promo Payment Request Record when there is an attachment added.

After searching and reading through other people's comments I found a code that would work for testing in my Sandbox environment. However now that I need to redo in Production, I have no clue where to start. See below for my code. I have downloaded Eclipse and installed the Force.com IDE, but am getting errors saying no synchronization, etc. Also receiving errors with the actual code when I try to write it in Eclipse.

Any help would be greatly apprecitated!!

User-added image
I think it has to do with my Apex test classes - I tried to change some classes from "private" to "public" but the classes wouldn't save and just show this error instead. (I am going through Apex Academy on pluralsight, so this is the example from there - the suggested method was "private class" in line 2, but it still gives me the error when I try to save it as "public class".
 
@isTest
private class LeadingCompetitorTest {
    
    @isTest static void createOppWithCompetitors() {
        // Create an opportunity and set required fields
        Opportunity opp = new Opportunity();
        opp.Name        = 'Big Deal';
        opp.CloseDate   = Date.today();
        opp.StageName   = 'Prospecting';

        // Set competitor price fields
        opp.Competitor_1_Price__c = 5000;
        opp.Competitor_2_Price__c = 15000;
        opp.Competitor_3_Price__c = 25000;

        // Set competitor fields
        opp.Competitor_1__c = 'Amazon';
        opp.Competitor_2__c = 'Google';
        opp.Competitor_3__c = 'Microsoft';

        insert opp;
        System.debug('Opportunity ' + opp.Name + ' inserted with all comeptitor fields populated.');

    }
}