• SFDC Learner
  • 0 Points
  • Member since 2013

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

What is the Solution to make an API Callout to an External URL after a Lead Record is inserted(Once Save button is Clicked on) , without using @Future Annotation. 


I have a wrapper class that creates a line item record on a parent record. The VF page lists the available items to add with an input text field that sets a integer with the quantity ordered.  The method is creating the record as expected, but the quantity is not being set properly. I'm not seeing what I'm missing in the process to properly set the quantity in the child record. Any suggestions? 


public class materialOrderWrapperClassController{

    public List<cProducvod> productList {get; set;}
    public Material_Order__c record;
    public List<Product_vod__c> availableProducts= new List<Product_vod__c>();
    public List<Material_Order_line_Item__c> linesToAdd {get;set;}
    public List<Material_Order_line_Item__c> qtysToUpdate {get;set;}
    public List<cProducvod> selectedProducts{get;set;}
    public Boolean hasProdSelect{get;set;}
    public Integer qty {get;set;}   
    public materialOrderWrapperClassController(ApexPages.StandardController stdController){
        record = [SELECT id, Name, Date__c, Status__c, Notes__c
                    FROM Material_Order__c 
                    WHERE id =:ApexPages.currentPage().getParameters().get('id')];
        selectedProducts = new List<cProducvod>();
        availableProducts = [SELECT id, Name, Image__c, Product_Type_vod__c 
                                FROM Product_vod__c 
                                WHERE Product_type_vod__c = 'Order'
                                ORDER BY Name ASC];
            //productList = new List<cProducvod>();
            if(productList == null){
              productList = new List<cProducvod>();                                        
              for(Product_vod__c p : availableProducts) {
                productList.add(new cProducvod(p));

    public List<cProducvod> getProductList() {
         return productList;
     public void setQty(Integer q){
     public Integer getQty(){
         return qty;
     public pageReference processSelected(){
          hasProdSelect = false;
            for(cProducvod cProd: getProductList()) {
                if(cProd.qty > 0) {
                    system.debug('cProd qty is >>>>'+cProd.qty);
        linesToAdd = new List<Material_Order_Line_Item__c>();
         for(cProducvod prdct : selectedProducts){
            Material_Order_line_Item__c newLine = new Material_Order_line_Item__c();
            newLine.Products__c = prdct.cProductvod.id;
            system.debug('newLine product name is>>>'+newLine.Products__c);
            newLine.Quantity__c = qty;
            system.debug('newLine qty is >>>'+newLine.Quantity__c);
            newLine.Material_Order__c = record.id;
         insert linesToAdd;
         pageReference enterAmount = new pageReference('/'+record.id);
          //pageReference enterAmount = new pageReference('/apex/enterAmt?id='+record.id);
          return enterAmount; 

 VF Code: 

<apex:page standardController="Material_Order__c" extensions="materialOrderWrapperClassController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}"/>
            <apex:pageBlockTable value="{!productList}" var="c" id="table">
                <apex:column >
                    <apex:inputText value="{!c.qty}"/>
            <apex:column value="{!c.cProductvod.Name}" headerValue="Product"/>
            <apex:column value="{!c.cProductvod.Image__c}" headerValue="Image"/>   
            <apex:column value="{!c.cProductvod.id}"/>