You need to sign in to do that
Don't have an account?
Soundar
How Can I Compare With a old map Id For Below Code
Dear Friends,
Let me know how can we compare with old map Id For Below Code
*********************************************************************************
*******************************************
Thanks IN Advance
Regards,
SOUNDAR RAJAN P
Let me know how can we compare with old map Id For Below Code
*********************************************************************************
trigger QuoteLineItemUpdateOnOpp on Quote (after insert,after Update) { IF(Trigger.isAfter && Trigger.isInsert){ Set<ID> qtId = New Set<Id>(); Set<Boolean> syn = New Set<Boolean>(); Set<Id> OppId = New Set<Id>(); List<OpportunityLineItem> lItem = New List<OpportunityLineItem>(); for(Quote q : Trigger.new){ qtId.add(q.Id); syn.add(q.Custom_Synchronize__c); } //Quote qt=trigger.new[0]; //Quote qt = New Quote(); IF(qtId.size() > 0){ System.debug('Quote Size : ' + qtId.size()); // List<Quote> qtList = [Select id,name from Quote Where ID =:qtId]; List<Quote_Line_Item__c> qtLItem = [Select Id,name,Quantity__c,Price__c,Quotes__c,Quotes__r.Opportunity.Id, Products__c from Quote_Line_Item__c Where Quotes__c IN :qtId]; System.debug('Quote Line Item Size : ' + qtLItem.size()); System.debug('Checking a Quote LineItem : ' + qtLItem); //List<Opportunity> oppty = New List<Opportunity>(); List<Opportunity> oppList = [Select id,name,CloseDate,(Select id,name,ListPrice from OpportunityLineItems) From Opportunity Where ID IN :oppId]; //Update QuoteLineItem To OpportunityLine Item For(Quote_Line_Item__c qteLineItem : qtLItem){ OpportunityLineItem OppLItem = New OpportunityLineItem(); OppLItem.Id = qteLineItem.Quotes__r.id; OppLItem.UnitPrice = qteLineItem.Price__c; OppLItem.Quantity = qteLineItem.Quantity__c; OppLItem.PricebookEntryId = qteLineItem.Products__c; lItem.add(OppLItem); } if(lItem.size() > 0){ update lItem; } } } }
*******************************************
Thanks IN Advance
Regards,
SOUNDAR RAJAN P
I had make some changes in below coding now it's working as well..
Quote ---> QuoteLineItem (Related List)---> Product will be create in Opportunity --> OppLineItem (Related List) When we click a synchronous button ....
Thanks for help me ...
Regards,
Soundar Rajan P
All Answers
If you are looking for code to only choose quote records for which some specific field has been updated on the trigger.new
Use the below code
Let me know if you need further help.
Thanks and Regards,
Shiva RV
Hi Shiva Rajendran,
Sorry for late reply ..
I tried your logic , it's showing new Error
ERROR : Incompatible key type Quote for Map<Id,Quote>
Could you please explain why this error was showing and how can i solve this error...
I had make some changes in below coding now it's working as well..
Quote ---> QuoteLineItem (Related List)---> Product will be create in Opportunity --> OppLineItem (Related List) When we click a synchronous button ....
Thanks for help me ...
Regards,
Soundar Rajan P
Sorry for the code issue. It was Id not Quote type in for loop
Thanks and Regards,
Shiva RV
Really Thanks for your help , finally that code has been changed and it's now working as per the requirement (You also given part of your work).
And i have an another one requirement also, i need your help again please. Kindly follow this link .
https://developer.salesforce.com/forums/?id=906F000000094GWIAY#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=OPENQUESTIONS&id=9060G000000UZrQQAW