0
global class creatorder {
  global class batchwrapper {
webservice List<Batch__c> child   {get;set;}
    webservice List<Quote_line_Item__c> data {get;set;}
    webservice  List<batch__c> finalbatch=new List<batch__c>() ;
    webservice List<batchwrapper> batch {get;set;}
   transient webservice string quoteId{get;set;}
    webservice String imageURL{get;set;}
    webservice String date1{get;set;}
    webservice String date2{get;set;}
    webservice String date3{get;set;}
    webservice String date4{get;set;}
    webservice String date5{get;set;}
    webservice String date6{get;set;}
    webservice String inputvalue{get;set;}
    set<id> qId;
        webservice Quote_Line_Item__c q {get;set;}
        webservice List<batch__c> batch1 {get;set;}

        global batchwrapper(){

            q = new Quote_Line_Item__c();
            batch1 = new List<batch__c>();
        }
  }

  webService static batchwrapper order(batchwrapper bw1) {
         quoteId=ApexPages.CurrentPage().getParameters().get('id');                
               qId = new set<id>();
                finalbatch=new List<batch__c>();
                Quote__c quo = [Select id,Generated__c,isEdited__c,isPreviewd__c,Gen_Num__c,Quote_Number_New__c from Quote__c where Id=:quoteId];
               data =[Select id,Name,Client_P_N__c,Description__c,Comments__c,LastModifiedDate ,Other_Lead_Time__c,Standard_Estimated_Lead_Time__c,Quote_Validity__c,Terms_Conditions__c from Quote_Line_Item__c where Quote1__c=: quo.Id order by CreatedDate] ;                
                for(Quote_Line_Item__c q :data ){
                 qId.add(q.Id);
                  }
        batch = new List<batchwrapper> ();
        finalbatch=[select id, confirm_Order__c,Unit_Price__c,MOD_Maxi__c,Unit_Price_Text__c,Sign_for_max_Quantity__c,Quantity_Text__c,LeadTime__c,Other_Lead_Time__c,Max_quantity_Pdf__c,Quantity__c,Max_Quantity__c,Asked_Qty__c, Sub_Unit_Price__c,Quote_Line_Item__c  from Batch__c  where Quote_Line_Item__c  in :qId ORDER BY Quantity__c asc];
        for(Quote_Line_Item__c q:data ){
            batchwrapper bw =  new batchwrapper();
            bw.q = q != null ? q : null;
            bw.batch1 = finalbatch != null ? finalbatch : null;
            batch.add(bw);  
            return batchwrapper;    
        }
  }
}

i need to get data from salesforce to other app using webservice any help will with this code will be greatly appreciated

error:

Error Error: createorder Compile Error: Variable does not exist: quoteId at line 28 column 10

I am very new to webservice .converting my apex class to webservice apex code . help me ....enter image description here

  • Why do you use the transient keyword to define the quoteId in your wrapper class? – Jair Jun 13 '14 at 1:18
1

The compile error you quote occurs because the quoteId field of the batchwrapper class can only be referenced via an instance of the class like this:

batchwrapper bw =  new batchwrapper();
bw.quoteId = ...;

If you need a variable to keep the value in within the static order method declare a local variable for that (and any other short-lived variables you need):

webService static batchwrapper order(batchwrapper bw1) {
    String quoteId = ApexPages.CurrentPage().getParameters().get('id');
    ...

Only fields that you need to pass into and out of the web service should be declared as fields of the batchwrapper class.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.