• rameshvpsg
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi, I have an requirement to roll up opportunity amount to all contacts linked through contact roles for an opportunity. Do any one have solution for this.

Thanks,

Ramesh V

I am using below trigger part of before update trigger on parent object to roll up amount from child object. This works fine for few records, but throws out too many soql queries error.

Please guide me  how i can bulkify this trigger.

 

Note: revenue_schedule__c is the parent object and training_sechedule__c is the child object.

 

for (revenue_schedule__c revenueschvar : trigger.new)
{
AggregateResult[] groupedResults = [SELECT SUM(amount__c)amt FROM training_schedule__c WHERE Revenue_Schedule__c = :revenueschvar.id];
revenueschvar.FTE_Revenue__c =(decimal)groupedResults[0].

get('amt');

}

Hi All,

I had a requirement of adding the oppporunity amount to all of its contact roles. if the contact role added the opportunity, the amount of opportunity has be added to a field "Achieved" on contact Object. The contact might be a contact role on multiple opportunities. If the contact role has been removed from td the opportunity, the respective amount to be subtracted from Achieved field of Opportunity object.

Please do let me know how can i get the solution. I appreciate all of your responses with code or any recommendations.

 

Also i have attached a screenshot for better understanding and any other solution based on the image.

Thanks,
Veeru

I am looking for a solution to automatically send an email alert to users who have not logged in to SF in the past 90 days (based on thier last login history field. I attempted a workflow/email alert but the User object is not available as a selection. Please help!

I'm trying to render validation rule error messages on my visual force pages.  Does anyone know how this can easily be done? 

 

From what I'm reading, I need to recreate the validation rules in an extension? (is that true!!?) 

 

Hoping for an easier approach!

 

TIA

Hello,

 

I would like to calculate the total amount of all child opportunities associated with the parent contact.

 

If a contact record has 2 opportunies, one with an amount of $20 and one with an amount of $50, i would like the contact record to have a field reflect the total of $50.

 

Below is the code i have so far.

------------------- 

trigger TestBed on Opportunity (after insert, after update)

{

 

 

//The list returns all the name of the contacts and the opportunity id and opportunity amount associated with that

contact

List<Contact> contax = [SELECT Contact.Name, (Select Opportunity.Id, Opportunity.Amount From Contact.Opportunities) From Contact Where Contact.AccountId != Null];

 

 

 

// Loop through the contacts and update their Opportunity Total field.

 for(Contact c : contax)

{

c.c_Opportunity_Total__c = contax.size();

}

 

// Update the database

 update contax;

 

 

 

 

}

---------------------

 

I would think it would be as easy as summing up the Opportunity.Amount.

 

LIke

 

c.c_Opportunity_Total__c = Sum(contax.Opportunity.Amount)

 

But that is not possible in this environment. Apparently the query fields associated with the list cannot be referenced. Or can they?

 

My questions are:

 

1.) With the above code, how can i reference the SOQL field Opportunity.Amount, and sum the total results of that query's findings for that field? Then add that total to the Contact record.

 

2.) Where can i find information about how to use math methods with SOQL?

 

Thanks so much for your help, so far i've spent hours trying to research this on my own with no luck. Newbie here.