You need to sign in to do that
Don't have an account?
shobana shobana 1
Thanks
Shobana
Initial term of field expression must be a concrete SObject: Set<String>
trigger InsertingBU on Opportunity (after update) { Set<Id> accountIds = new Set<Id>(); for(Opportunity o : Trigger.New) accountIds.add(o.AccountId); list<Business_Unit_Company__c> BUCUpdate = new list<Business_Unit_Company__c>(); list<Business_Unit_Company__c> Bus1 = new list<Business_Unit_Company__c>(); Map<Id,Business_Unit_Company__c> bus = new Map<Id,Business_unit_Company__c>(); set<string> busStage = new set<string>(); for(Business_Unit_Company__c bu : [Select Business_Unit__c,Company__c,Stage__c from Business_Unit_Company__c where Company__c IN: accountIds]){ bus.put(bu.Business_Unit__c, bu); busStage.add(bu.Stage__c); } for(Opportunity o : Trigger.New) { if(o.Opportunity_Business_Unit__c != null && bus.get(o.Opportunity_Business_Unit__c) != null){ if((busStage.Stage__c == 'Closed Lost') && ((o.StageName =='0 - Existing Customer Lead') || (o.StageName =='1 - Prospecting') || (o.StageName =='Qualification') ||(o.StageName =='2 - Client Interaction') ||(o.StageName =='Needs Analysis') || (o.StageName =='3 - Quoting Client') ||(o.StageName =='Value Proposition') ||(o.StageName =='Id. Decision Makers') ||(o.StageName =='Perception Analysis') ||(o.StageName =='4 - Buying Signals') || (o.StageName =='5 - Quoted/Final Negotiation') || (o.StageName =='Proposal/Price Quote') || (o.StageName =='Negotiation/Review')) ){ Business_Unit_Company__c bu1 = new Business_Unit_Company__c(); Bu1.stage__c='Closed Lost'; Bu1.Company__c=o.AccountId; Bu1.Business_Unit__c= o.Opportunity_Business_Unit__c; Bus1.add(bu1); break; }else if( (bus1.Stage__c== 'Open') && (o.StageName=='Closed Lost')){ Business_Unit_Company__c Bu2 = new Business_Unit_Company__c(); Bu2.stage__c='Closed Lost'; Bu2.Company__c=o.AccountId; Bu2.Business_Unit__c= o.Opportunity_Business_Unit__c; Bus1.add(Bu2); break; }else if((bus1.Stage__c== 'Closed Lost') && (o.StageName=='Closed Won')){ Business_Unit_Company__c Bu3 = new Business_Unit_Company__c(); Bu3.stage__c='Closed Won'; Bu3.Company__c=o.AccountId; Bu3.Business_Unit__c= o.Opportunity_Business_Unit__c; Bus1.add(Bu3); break; } }else{ Business_Unit_Company__c BUC = new Business_Unit_Company__c(); BUC.Company__c=o.AccountId; BUC.Business_Unit__c=o.Opportunity_Business_Unit__c; if(o.StageName == 'Closed Won' || o.StageName == 'Closed Lost'){ BUC.Stage__c=o.StageName; }else{ BUC.Stage__c='Open'; } BUCUpdate.add(BUC); } } if(Bus1!= Null) update Bus1; if(BUCUpdate!= Null) insert BUCUpdate; }In the third for loop am getting error can anyone help me out to solve this...
Thanks
Shobana
if(o.Opportunity_Business_Unit__c != null && bus.get(o.Opportunity_Business_Unit__c) != null)
{
Business_Unit_Company__c bus = bus.get(o.Opportunity_Business_Unit__c);
if( ( bus.Stage__c == 'Closed Lost') )
Let us know if this will help you
All Answers
Let us know if this will work
Thannks
Amit Chaudhary
Thank you for your reply. Actually for 23rd line i don't want to check in opportunity field(o.Stage__c == 'Closed Lost') , i want to get the value from 11 line set value.
if(o.Opportunity_Business_Unit__c != null && bus.get(o.Opportunity_Business_Unit__c) != null)
{
Business_Unit_Company__c bus = bus.get(o.Opportunity_Business_Unit__c);
if( ( bus.Stage__c == 'Closed Lost') )
Let us know if this will help you
Thank you for your help