• jack-cepheid
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

I'm new to Apex in general and cannot seem to get this trigger to work...

I have a custom object LOC that has a related custom object called GPO.

I need to have a trigger that will update a related user field on LOC with the owner of the related GPO.

 

I need the related user so I can use it in an approval process.

 

Here is what I have so far and it does nothing. From my research I know maps are needed but I don't understand the concept at this point.

 

trigger LOCapprover on LOC__c (before insert,before update) {
    for(LOC__c loc: Trigger.new){
        if(loc.LOC_GPO__c != null)
    loc.Receiving_User__c = loc.LOC_GPO__r.Owner.Id;  
        
    }    
}

 

I have built several Discount formula fields in the Opportunity Product to reflect contract selections from the Account page. The Problem is that i have several fields and i would like to eliminate field that do not need to be shown for that given opportunity.

I heard that I could use Apex Triggers to determine the page layout that is selected.  So my question is two fold, 

1) is that true that i could use a trigger that looks at a field in the Account page to determine the page layout of the Opportunity products for that account.

 

2) How do i do that? (i'm great with formulas but code not so much i can customize visualforce but i have not written much on my own)

 

 

I’m trying to build out some formula based fields and I’m unable to do a certain function no matter what I try. What I want to do is build a formula that will calculate discounts based on the Total quantity of products that are in an opportunity. Now there is a standard Total Opportunity Quantity field but it does not give me the calculation that I need. I need the calculation to look at the Quantity of the part number in the opportunity and multiply that by a custom field in the Product record that says how many items are in that part number. This calculation would need to be duplicated for each product (limited by a certain group of product families of course) and the total either returned to a custom field as  number or just used in the formula to figure a discount. An example would be…In the Product setup. Part number M-120 has a custom field that says that part number contains 120 items                                Part number G-10 has a custom field that says that part number contains 10 items            Both are assigned to the same product familyIn the OpportunityCustomer XYZ            Is ordering 3 of part number M-120            And 5 of part number G-10 (the standard SFDC field would say the opportunity quantity is 8) I want a formula to be able to see that 3 of part number M-120 =360 itemsAnd that 5 of part number G-10 = 50 items So the total number of items for that product family is 410 The discount would just be a greater/less than calculation that would say that the quantity is eligible for a 3% discount. Please let me know if there is a way to make that formula… Again I can do this for individual products right now but I need to do it one level higher at the opportunity level.

I'm new to Apex in general and cannot seem to get this trigger to work...

I have a custom object LOC that has a related custom object called GPO.

I need to have a trigger that will update a related user field on LOC with the owner of the related GPO.

 

I need the related user so I can use it in an approval process.

 

Here is what I have so far and it does nothing. From my research I know maps are needed but I don't understand the concept at this point.

 

trigger LOCapprover on LOC__c (before insert,before update) {
    for(LOC__c loc: Trigger.new){
        if(loc.LOC_GPO__c != null)
    loc.Receiving_User__c = loc.LOC_GPO__r.Owner.Id;  
        
    }    
}

 

I’m trying to build out some formula based fields and I’m unable to do a certain function no matter what I try. What I want to do is build a formula that will calculate discounts based on the Total quantity of products that are in an opportunity. Now there is a standard Total Opportunity Quantity field but it does not give me the calculation that I need. I need the calculation to look at the Quantity of the part number in the opportunity and multiply that by a custom field in the Product record that says how many items are in that part number. This calculation would need to be duplicated for each product (limited by a certain group of product families of course) and the total either returned to a custom field as  number or just used in the formula to figure a discount. An example would be…In the Product setup. Part number M-120 has a custom field that says that part number contains 120 items                                Part number G-10 has a custom field that says that part number contains 10 items            Both are assigned to the same product familyIn the OpportunityCustomer XYZ            Is ordering 3 of part number M-120            And 5 of part number G-10 (the standard SFDC field would say the opportunity quantity is 8) I want a formula to be able to see that 3 of part number M-120 =360 itemsAnd that 5 of part number G-10 = 50 items So the total number of items for that product family is 410 The discount would just be a greater/less than calculation that would say that the quantity is eligible for a 3% discount. Please let me know if there is a way to make that formula… Again I can do this for individual products right now but I need to do it one level higher at the opportunity level.