You need to sign in to do that
Don't have an account?
Jim Montgomery
Getting error Initial term of field expression must be a concrete SObject: Map<Id,Apttus_Proposal__Proposal__C>
Here is my code.
trigger TLIYear1Rollup on Template_Line_item__c (after insert, after update) {
Map<ID, Apttus_Proposal__Proposal__c> parentProposal = new Map<ID, Apttus_Proposal__Proposal__c>();
List<Id> listIds = new List<Id>();
List<Id> LineItems = new List<Id>();
for (Template_Line_item__c childObj : Trigger.new) {
listIds.add(childObj.Quote_Proposal__c);
LineItems.add(childObj.Id);
}
parentProposal = new Map<Id, Apttus_Proposal__Proposal__c>([SELECT id,TLI_Net_Price_Rollup__c ,(Select id, Net_Price__c, Year_2_Price_Form__c, Year_3_Price_Form__C, Year_4_Price_Form__c, Year_5_Price_Form__C from Template_Line_Items__r where net_price__c > 0) FROM Apttus_Proposal__Proposal__c WHERE ID IN :listIds]);
for (Template_Line_item__c TemplateLineItem: Trigger.new){
Apttus_Proposal__Proposal__c myParentProposal = parentProposal.get(TemplateLineItem.Quote_Proposal__c);
if(parentProposal.containsKey(TemplateLineItem.Quote_Proposal__c) && parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r.size() > 0)
{
myParentProposal.TLI_Net_Price_Rollup__c = SUM(ParentProposal.Net_Price__C);
}
else
{
myParentProposal.TLI_Net_Price_Rollup__c = 0 ;
}
}
update parentProposal.values();
}
trigger TLIYear1Rollup on Template_Line_item__c (after insert, after update) {
Map<ID, Apttus_Proposal__Proposal__c> parentProposal = new Map<ID, Apttus_Proposal__Proposal__c>();
List<Id> listIds = new List<Id>();
List<Id> LineItems = new List<Id>();
for (Template_Line_item__c childObj : Trigger.new) {
listIds.add(childObj.Quote_Proposal__c);
LineItems.add(childObj.Id);
}
parentProposal = new Map<Id, Apttus_Proposal__Proposal__c>([SELECT id,TLI_Net_Price_Rollup__c ,(Select id, Net_Price__c, Year_2_Price_Form__c, Year_3_Price_Form__C, Year_4_Price_Form__c, Year_5_Price_Form__C from Template_Line_Items__r where net_price__c > 0) FROM Apttus_Proposal__Proposal__c WHERE ID IN :listIds]);
for (Template_Line_item__c TemplateLineItem: Trigger.new){
Apttus_Proposal__Proposal__c myParentProposal = parentProposal.get(TemplateLineItem.Quote_Proposal__c);
if(parentProposal.containsKey(TemplateLineItem.Quote_Proposal__c) && parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r.size() > 0)
{
myParentProposal.TLI_Net_Price_Rollup__c = SUM(ParentProposal.Net_Price__C);
}
else
{
myParentProposal.TLI_Net_Price_Rollup__c = 0 ;
}
}
update parentProposal.values();
}
Map<ID, Apttus_Proposal__Proposal__c> parentProposal = new Map<ID, Apttus_Proposal__Proposal__c>();
List<Id> listIds = new List<Id>();
List<Id> LineItems = new List<Id>();
for (Template_Line_item__c childObj : Trigger.new) {
listIds.add(childObj.Quote_Proposal__c);
LineItems.add(childObj.Id);
}
parentProposal = new Map<Id, Apttus_Proposal__Proposal__c>([SELECT id,TLI_Net_Price_Rollup__c ,(Select id, Net_Price__c, Year_2_Price_Form__c, Year_3_Price_Form__C, Year_4_Price_Form__c, Year_5_Price_Form__C from Template_Line_Items__r where net_price__c > 0) FROM Apttus_Proposal__Proposal__c WHERE ID IN :listIds]);
for (Template_Line_item__c TemplateLineItem: Trigger.new){
Apttus_Proposal__Proposal__c myParentProposal = parentProposal.get(TemplateLineItem.Quote_Proposal__c);
if(parentProposal.containsKey(TemplateLineItem.Quote_Proposal__c) && parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r.size() > 0)
{
//myParentProposal.TLI_Net_Price_Rollup__c = SUM(ParentProposal.Net_Price__C);
myParentProposal.TLI_Net_Price_Rollup__c=0;
for(Template_Line_Items__c tempLineItem : parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r){
myParentProposal.TLI_Net_Price_Rollup__c=myParentProposal.TLI_Net_Price_Rollup__c+tempLineItem.Net_Price__C;
}
}
else
{
myParentProposal.TLI_Net_Price_Rollup__c = 0 ;
}
}
update parentProposal.values();
}
All Answers
Hi Jim,
Can you tell me the line number at which the error is thrown.
Map<ID, Apttus_Proposal__Proposal__c> parentProposal = new Map<ID, Apttus_Proposal__Proposal__c>();
List<Id> listIds = new List<Id>();
List<Id> LineItems = new List<Id>();
for (Template_Line_item__c childObj : Trigger.new) {
listIds.add(childObj.Quote_Proposal__c);
LineItems.add(childObj.Id);
}
parentProposal = new Map<Id, Apttus_Proposal__Proposal__c>([SELECT id,TLI_Net_Price_Rollup__c ,(Select id, Net_Price__c, Year_2_Price_Form__c, Year_3_Price_Form__C, Year_4_Price_Form__c, Year_5_Price_Form__C from Template_Line_Items__r where net_price__c > 0) FROM Apttus_Proposal__Proposal__c WHERE ID IN :listIds]);
for (Template_Line_item__c TemplateLineItem: Trigger.new){
Apttus_Proposal__Proposal__c myParentProposal = parentProposal.get(TemplateLineItem.Quote_Proposal__c);
if(parentProposal.containsKey(TemplateLineItem.Quote_Proposal__c) && parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r.size() > 0)
{
//myParentProposal.TLI_Net_Price_Rollup__c = SUM(ParentProposal.Net_Price__C);
myParentProposal.TLI_Net_Price_Rollup__c=0;
for(Template_Line_Items__c tempLineItem : parentProposal.get(TemplateLineItem.Quote_Proposal__c).Template_Line_Items__r){
myParentProposal.TLI_Net_Price_Rollup__c=myParentProposal.TLI_Net_Price_Rollup__c+tempLineItem.Net_Price__C;
}
}
else
{
myParentProposal.TLI_Net_Price_Rollup__c = 0 ;
}
}
update parentProposal.values();
}