• shyam Sundar 101
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies
How to generate QR Code fro SFDC to cature Event Attendees. I have a Picklist Field (Attended - Yes/No) . I installed a barcode from PlayStore for Android. And Kept a QR code field as a formula field in PageLayout. I need to Change the Attended picklist value as YES. Once evry time the QR Code is scanned by the attendee.
Hi,

I have a an object called payment_plan__c which is parent and child payment_detail__c is child.. I want to create a vf page in another object called Bookin__c which has a lookup (Payment_Plan__c) .Need to fetch child record(i.e) Payment_Details_c  Based on the lookup value in booking object on a button click in booking object

Thanks in advance,
Shyam.
Once i choose product in OpportunityProduct the QtyOnHand__c Field i have in Prdocut2 is getting reduced fine. But I made a Query on Opportunity to fetch the StageName. If Stage is ClosedLost the previous value must get added to QtyOnHand__c . This adding inventory when oppurtunit lost is not working.

This is my trigger!! help me with the code.

trigger RemainingQuant on OpportunityLineItem (after insert, before update) {

  
    set<id> PIds = new set<id>();
  
    String o =  [select StageName From Opportunity ][0].StageName;
   for(OpportunityLineItem opli : Trigger.new){
       PIds.add(opli.Product2Id);
   } 
   
         
     list<Product2> pList = [select id, name , QtyOnHand__c from Product2 where Id IN : PIds];  
     
   
   
   
     for(Product2 p : pList){
      
         for(OpportunityLineItem op : Trigger.new){
             if(p.id == op.product2Id ){ 
             
            
                 if(Trigger.isInsert){
                     if(op.Quantity > p.QtyOnHand__c){
                         op.Quantity.addError(' no availability of stock in Product ');
                     }
                     
               
                    p.QtyOnHand__c-= op.Quantity;
                 


              
}               
    
     
                 if(Trigger.isUpdate){
                 
                 if(o == 'Closed Lost'){
                                     
                     p.QtyOnHand__c += (Trigger.oldMap.get(op.Id).Quantity).intValue();
                        
                        
                }        
                        
                    
                 }}
             }
             
     
   
    
    update pList;
 
 } 
}
When opportunity is closed won and based on the quantity which i give in opportunity line item .. The customer field QtyOnHand__c in Product2 should get changed with the amount of quantity which i select... 


trigger RemainingQuant on OpportunityLineItem (after insert,before update) {

    set<id> PIds = new set<id>();
    set<id> Oids = new set<id>();
   for(OpportunityLineItem opli : Trigger.new){
       PIds.add(opli.Product2Id);
   }
     list<Product2> pList = [select id, name , QtyOnHand__c from Product2 where Id IN : PIds];  
     list<Opportunity> olist = [select id, name, StageName from Opportunity where Id IN : Oids]; 
     for(Opportunity o : olist){
     for(Product2 p : pList){
      
         for(OpportunityLineItem op : Trigger.new){
             if(p.id == op.product2Id && op.OpportunityId== o.id){
             if(o.StageName == 'Closed Won'){
               
                 if(Trigger.isInsert){
                     if(op.Quantity > p.QtyOnHand__c){
                         op.Quantity.addError(' no availability of stock in Product ');
                     }
                     }
                 
                    p.QtyOnHand__c-= op.Quantity;
                 

                
}                 
                 if(Trigger.isUpdate){
                                     
                     p.QtyOnHand__c += (Trigger.oldMap.get(op.Id).Quantity).intValue();
                        
                     if(op.Quantity > p.QtyOnHand__c){
                         op.addError(' no availability of stock in Product ');
                     } 
                     p.QtyOnHand__c-=op.Quantity;
                     
                 }
             }
             
       }
    }
    update pList;
  
}
}
i have a custom field called QtyOnHand__c in Product2 and Quantity in opportunity Line Item  . I have a scenario if the opportunity is closed won.
Based on the quantity the qtyOnHand in product should get decreased. help me with trigger.                                                                                                                
How to generate QR Code fro SFDC to cature Event Attendees. I have a Picklist Field (Attended - Yes/No) . I installed a barcode from PlayStore for Android. And Kept a QR code field as a formula field in PageLayout. I need to Change the Attended picklist value as YES. Once evry time the QR Code is scanned by the attendee.
Hi,

I have a an object called payment_plan__c which is parent and child payment_detail__c is child.. I want to create a vf page in another object called Bookin__c which has a lookup (Payment_Plan__c) .Need to fetch child record(i.e) Payment_Details_c  Based on the lookup value in booking object on a button click in booking object

Thanks in advance,
Shyam.
When opportunity is closed won and based on the quantity which i give in opportunity line item .. The customer field QtyOnHand__c in Product2 should get changed with the amount of quantity which i select... 


trigger RemainingQuant on OpportunityLineItem (after insert,before update) {

    set<id> PIds = new set<id>();
    set<id> Oids = new set<id>();
   for(OpportunityLineItem opli : Trigger.new){
       PIds.add(opli.Product2Id);
   }
     list<Product2> pList = [select id, name , QtyOnHand__c from Product2 where Id IN : PIds];  
     list<Opportunity> olist = [select id, name, StageName from Opportunity where Id IN : Oids]; 
     for(Opportunity o : olist){
     for(Product2 p : pList){
      
         for(OpportunityLineItem op : Trigger.new){
             if(p.id == op.product2Id && op.OpportunityId== o.id){
             if(o.StageName == 'Closed Won'){
               
                 if(Trigger.isInsert){
                     if(op.Quantity > p.QtyOnHand__c){
                         op.Quantity.addError(' no availability of stock in Product ');
                     }
                     }
                 
                    p.QtyOnHand__c-= op.Quantity;
                 

                
}                 
                 if(Trigger.isUpdate){
                                     
                     p.QtyOnHand__c += (Trigger.oldMap.get(op.Id).Quantity).intValue();
                        
                     if(op.Quantity > p.QtyOnHand__c){
                         op.addError(' no availability of stock in Product ');
                     } 
                     p.QtyOnHand__c-=op.Quantity;
                     
                 }
             }
             
       }
    }
    update pList;
  
}
}
i have a custom field called QtyOnHand__c in Product2 and Quantity in opportunity Line Item  . I have a scenario if the opportunity is closed won.
Based on the quantity the qtyOnHand in product should get decreased. help me with trigger.