• Saniya Khan 2
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 13
    Replies
Hi All,
I got an requirement in which want to display campaign member and its partner status of perticuler event in one vf page.
and each event have 1000's of campaign member and want to display campaign member details and its partner details.
I am using wrapper class for this so I can combine the campaign member details and its partner details in one page .
but in for loap when I try to retrieve partner details from its throwing an  error of so many query.

How to deal with this?
Any help will be appreciated.
Many thanks,
Saniya

 
Hi Guys,
I have one query in which I have to create puchase order from the opportunity Line item  depending upon the supllier and delivery address.
for example 
Product  supplier delevery address
A             Sam       Home
B              Sam      home
C              John      Home
D               John     Office
then in that case it will create 3 purchase order
PO-1 A and B
PO-2  for C
PO-3  for D
How can we do mapping?

Many thanks,
Saniya
I have wrapper class which I want to pass to batch class as want to send 1000's of email and also want to update records
Hi All,
I am trying to integrate salesforce with workday.
I tried with SoapUI APP for testing and its working fine but when I tried same xml in apex class using HTTPrequest its not working and throwing an error Invalid request.
Could anyone pleasde help me with this it will be appreciates.

Here is my apex code with xml string

public class Test2 {
   public static void test_m(){
     String body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc">'+
           '<soapenv:Header>' +
              '<bsvc:Workday_Common_Header>' +
                 '<bsvc:Include_Reference_Descriptors_In_Response>'+'1'+'</bsvc:Include_Reference_Descriptors_In_Response>' +
              '</bsvc:Workday_Common_Header>' +
           '</soapenv:Header>' +
           '<soapenv:Body>' +
              '<bsvc:Get_Customer_Invoices_Request bsvc:version="v31.1">' +
                 '<bsvc:Request_References>' +
                    '<bsvc:Customer_Invoice_Reference bsvc:Descriptor="?">' +
                       '<bsvc:ID bsvc:type="WID">a36116d317ae81ecf995ece9cxxxxxxx</bsvc:ID>' +
                    '</bsvc:Customer_Invoice_Reference>' +
                               '</bsvc:Get_Customer_Invoices_Request>' +
           '</soapenv:Body>' +
        '</soapenv:Envelope>';
       System.debug('Message'+body);
    HTTP h = new HTTP();
    HTTPRequest r = new HTTPRequest();
    r.setEndpoint('https://wd3-impl-services1.workday.com/ccx/service/XXX/Revenue_Management/v31.1');
    Blob headerValue = Blob.valueOf('ISU_XXXX_XXx@tenent' + ':' + 'XXXXX!');
   String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
    r.setHeader('Authorization', authorizationHeader);
    r.setHeader('Content-Type','text/xml;charset=UTF-8');
    r.setHeader('AllowAutoRedirect', 'True');
    r.setHeader('UseDefaultCredentials','False'); 
      r.setHeader('AuthenticationLevel', 'Net.Security.AuthenticationLevel.None');
       r.setHeader('SOAPAction', 'https://wd3-impl-services1.workday.com/ccx/service/xxx/Revenue_Management/v31.1');
    r.setMethod('GET');
    r.setBody(body);
    HTTPResponse resp = h.send(r);
    system.debug('Body::'+resp.getbody());
 }
}
Many thanks,
Saniya
Hi All,
Is there any way to call external webservices without wsdl ?As some apex2wsdl desn't work.
If anyone have some examples please share.

Thanks,
Saniya
Hi All,
I am trying to connect salesforce and workday customer invoices.
I can able to connect get_customer_invoice function via SOAPUI App but unfortunatly can't able with salesforce by using apex2wsdl class the only hing which I am not seting in httpinputheader is wss-passwordtype which I am setting in SOAPUI.
And its throwing invalid username or password.
I think reson for this error is I am not setting wss pasword type.Can anyone please help me with this.
 public String endpoint_x = 'https://wd3-impl-services1.workday.com/ccx/service/xxxx/Revenue_Management/v31.1';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};
            
Many Thanks,
Saniya
Hi All,
I am trying to integrate workday with salesforce by using wsdl classes but I am getting above error.
could anyone please help me with this.

Here is my code
public class Revenue_Management {
        public String endpoint_x = 'https://wd3-impl-services1.workday.com/ccx/service/chime5/Revenue_Management/v31.1';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};
    public comWorkdayBsvc.Submit_Customer_Invoice_ResponseType Submit_Customer_Invoice(comWorkdayBsvc.Customer_InvoiceObjectType Customer_Invoice_Reference,comWorkdayBsvc.Financials_Business_Process_ParametersType Business_Process_Parameters,comWorkdayBsvc.Customer_Invoice_WWS_DataType Customer_Invoice_Data) {
            comWorkdayBsvc.Submit_Customer_Invoice_RequestType request_x = new comWorkdayBsvc.Submit_Customer_Invoice_RequestType();
            comWorkdayBsvc.Submit_Customer_Invoice_ResponseType response_x;
            request_x.Customer_Invoice_Reference = Customer_Invoice_Reference;
            request_x.Business_Process_Parameters = Business_Process_Parameters;
            request_x.Customer_Invoice_Data = Customer_Invoice_Data;
           
            Blob headerValue = Blob.valueOf('xxx.sxxxx@xxx5' + ':' + 'xxxxx');

            String authorizationHeader = 'Basic ' +EncodingUtil.base64Encode(headerValue);

          //  String sURL = 'https:/testURL';

            System.debug('***authorizationHeader***'+authorizationHeader);

            this.inputHttpHeaders_x = new Map<String,String>();

            //response_x.inputHttpHeaders_x.put('URL',sURL);       

            this.inputHttpHeaders_x.put('Authorization',authorizationHeader);
            
            Map<String, comWorkdayBsvc.Submit_Customer_Invoice_ResponseType> response_map_x = new Map<String, comWorkdayBsvc.Submit_Customer_Invoice_ResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'urn:com.workday/bsvc',
                'Submit_Customer_Invoice_Request',
                'urn:com.workday/bsvc',
                'Submit_Customer_Invoice_Response',
                'comWorkdayBsvc.Submit_Customer_Invoice_ResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }

        
Hi All,
I generated the apex classes from wsdl but didn't know how to specify credential.
here is code for that 
public class Revenue_Management {
        public String endpoint_x = 'Revenue_Management';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};

        public comWorkdayBsvc.Cash_SaleObjectType Cancel_Cash_Sale(comWorkdayBsvc.Cash_SaleObjectType Cash_Sale_Reference) {
            comWorkdayBsvc.Cancel_Cash_Sale_RequestType request_x = new comWorkdayBsvc.Cancel_Cash_Sale_RequestType();
            comWorkdayBsvc.Cancel_Cash_Sale_ResponseType response_x;
            request_x.Cash_Sale_Reference = Cash_Sale_Reference;
            Map<String, comWorkdayBsvc.Cancel_Cash_Sale_ResponseType> response_map_x = new Map<String, comWorkdayBsvc.Cancel_Cash_Sale_ResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'urn:com.workday/bsvc',
                'Cancel_Cash_Sale_Request',
                'urn:com.workday/bsvc',
                'Cancel_Cash_Sale_Response',
                'comWorkdayBsvc.Cancel_Cash_Sale_ResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Cash_Sale_Reference;
        }

It will will be grat if anyone will help me.

Many Thanks,
Saniya
Hi All,
I want to integrate workday with salesforce and using Revenue_Managment service.So  I downloaded its wsdl file which is Revenue_Managment.wsdl but while parsing it showing an error.
Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute. At: 119:74

Could anyone please help me with this.

Many Thanks,
Saniya
Hi guys,
How we can integrate salesforce with workday?
any help will be appretiated..

Many Thanks,
Saniya
Hi All,
Is any one know how to integrate salesforce with the graydon ?
wanted to get follwing 
getCountry 
getCompanyMatchesByX 
placeOrder

Any help will be appreciated.
Many thanks,
saniya
Hi All,
I am working on vf page it have two command button

      
                              <apex:commandButton value="Add Row" action="{!addBackgroundRows}"  rerender="backgroundtable3" id="ShowAllTheFields"  >
                                   <apex:param name="addCount" value="1" assignTo="{!addCount}"/></apex:commandButton>
                             
                             <apex:commandButton value="Add Row" action="{!addBackgroundRows}" rerender="backgroundcomment2" id="ShowsingleField"  >
                                  <apex:param name="addCount" value="1" assignTo="{!addCount}"/></apex:commandButton>

Want to make second button diabled instially and first button visible but after clicking first button want to hide first button permanantly abd dispay second button only.

It will be greate if anyone help me with this.

Many thanks,
saniya
                            
                             
Hi All,
I am working on vf page where the requirement is 

in this out put pane want to display the first record 
 <apex:outputPanel layout="none" rendered="{!IF(Underwriting__c.createdDate>compaireDate,true,false)}" >
                             <apex:pageBlockSection title="Background" id="backgroundtable3" > 
                                 <apex:pageBlockSectionItem >
                                     <apex:outputPanel layout="none" >
                              <table style="height:auto;" >
                         <apex:repeat value="{!backgroundComment}" var="s">
                             <tr><td>
                                 <tr><td>Industry Category</td>
                                     <td>Industry</td>
                                 <td>Entity Type</td>
                                     <td>Trading time</td>
                                     <td>Location</td>
                                 </tr>
                         <tr>
                             
                             <td><apex:inputField value="{!s.com.Industry__c}" style="width:300px;"/></td>
                              <td><apex:inputField value="{!s.com.IndudtrySubCategory__c}" style="width:300px;"/></td>
                             <td><apex:inputField value="{!s.com.Entity_Type__c}" style="width:300px;"/></td>
                             <td><apex:inputField value="{!s.com.Trading_time__c}" style="width:300px;"/></td>
                             <td><apex:inputField value="{!s.com.Location__c}" style="width:300px;"/></td> 
                             
                         </tr>
                        <!-- </apex:repeat>
                            <apex:repeat value="{!backgroundComment}" var="s" >-->
                                 
                         <tr>
                             <td colspan="4px"><apex:inputField value="{!s.com.Background_Comments__c}" style="width:1210px;height:70px;">
                                    </apex:inputField></td>
                             <td rowspan="5px"> <apex:commandButton value="Delete" action="{!deletebgRow}" rerender="backgroundtable3" style="{!IF(s.com.id = null,'display:none','')}" >
                                        <apex:param name="toDelIdent" value="{!s.com.id}" assignTo="{!toDelQuery }" /></apex:commandButton></td>
                         </tr>
                    <!--     </apex:repeat>
                        <apex:repeat value="{!backgroundComment}" var="s" >-->
                                 <tr>
                                     <td>Purpose Of Funds</td>
                                     <td>Card Processor</td>
                                     <td>average Card Sale</td>
                                     <td>Seasonal</td>
                                     </tr>
                         <tr>
                             <td><apex:inputField value="{!s.com.Purpose_of_funds__c}" style="width:300px;">
                                    </apex:inputField></td>
                             <td><apex:inputField value="{!s.com.Card_Processor__c}" style="width:300px;">
                                    </apex:inputField>
                            </td>
                             <td><apex:inputField value="{!s.com.Average_card_sales__c}" style="width:300px;">
                                    </apex:inputField></td>
                             <td><apex:inputField value="{!s.com.Seasonality__c}" style="width:300px; ">
                                    </apex:inputField></td>
                         </tr>
                   
                       <!--  <tr>
                             <td colspan="4px" style="white-space:nowrap;"><apex:inputField value="{!s.com.Background_Comments2__c}" style="width:1210px;  height:70px;  ">
                                    </apex:inputField></td>
                         </tr>-->
                               </td>
                               </tr>
                         </apex:repeat>
                
                     </table>
                                     </apex:outputPanel>
                                 </apex:pageBlockSectionItem>
                             </apex:pageBlockSection>       
                         </apex:outputPanel>
at the moment I used repeate thats why its display all the record but i only want to show first one 

and in second output pane want to display records from second to the last 
 <apex:outputPanel id="backgroundcomment2">
                            
                           <table style="height:auto;" >
                         <apex:repeat value="{!backgroundComment}" var="v">
                             <tr style="{IF(LEN(v)<2,'display:none','')}">
                             <td style="white-space:nowrap;"><apex:inputField value="{!v.com.Background_Comments2__c}" style="width:1210px;  height:70px;  ">
                                    </apex:inputField></td>
                             <td > <apex:commandButton value="Delete" action="{!deletebgRow}" rerender="backgroundcomment2" style="{!IF(v.com.id = null,'display:none','')}" >
                                     <apex:param name="toDelIdent" value="{!v.com.id}" assignTo="{!toDelQuery }" /></apex:commandButton></td>
                         </tr>
                               </apex:repeat>
                             </table>
                                     </apex:outputPanel>
                                 
                              <apex:commandButton value="Add Row" action="{!addBackgroundRows}" rerender="backgroundtable3" >
                                   <apex:param name="addCount" value="1" assignTo="{!addCount}"/></apex:commandButton>
                             
                             <apex:commandButton value="Add Row" action="{!addBackgroundRows}" rerender="backgroundcomment2" >
                                  <apex:param name="addCount" value="1" assignTo="{!addCount}"/></apex:commandButton>
                            
                             
                         </apex:outputPanel>    


as both the output panel uses the same object is just first one display all the fields from object and in second panel want to dispay single field from the same object.

Please help me with this.
Many thanks,
Saniya
 
Hi All,
I want to integrate salesforce custom object to Mailchimp list,but its showing status 401. Don't know where to put API key and usename.
Any help will be apreciable.
here is my code after update trigger I am calling API call
global class LeadIntegrationMailChimp {

    Public static MailChimpSetting__c mailchimpsetting = MailChimpSetting__c.getInstance();
    @future(callout=true)
    
    public static void sendInfo(string LeadID)
    {
        Lead__c LeadList=[Select Name,Email__c,Address__c,Contact_Phone__c,Company_Name__c,Status__c from lead__c where id=:LeadID];
        
            String ContactName=LeadList.Name;
            List<String> Splitname=ContactName.split(' ');
            System.debug('First Name'+Splitname[0]);
            system.debug('Last Name'+Splitname[1]);
            JSONGenerator gen = JSON.createGenerator(true);
            gen.writeStartObject();
         /* String ContactName=LeadList.Name;
            gen.writeStringField('FName',Splitname[0]);
            gen.writeStringField('LName',Splitname[1]);
            gen.writeStringField('Address',leadList.Address__c);
            gen.writeStringField('Phone Number',leadList.Contact_Phone__c);
            gen.writeStringField('Business Name',leadList.Company_Name__c);
            gen.writeStringField('status',leadList.Status__c);
           */ 
            gen.writeStringField('email_address', leadList.Email__c);
      
            gen.writeStringField('status',leadList.Status__c);
            gen.writeEndObject();   
            String jsonS = gen.getAsString();
        
            System.debug('Jjson string'+jsonS);
            
            HTTP auth = new HTTP();
  
        HTTPRequest r = new HTTPRequest();    
       r.setEndpoint('https://usXX.api.mailchimp.com/3.0/lists/bxxxxxxxxx/members');
        r.setHeader('Authorization','Saniya:111b1b1ba1111111111-usXX');
        r.setHeader('Content-Type','application/json');
        
        r.setMethod('POST');   
        r.setBody(jsonS);  
        System.debug('Request'+r);
        HTTPResponse authresp=new HttpResponse();
            authresp=auth.send(r);
        system.debug('Response Is'+authresp);
        
    }
}
Many Thanks,
Saniya
Hi All,
I am preparing for salesforce daveloper 1 certification ,Is anyoune have study material?
If yes could you please share wih me it will be very geartfull.

Many Thanks,
Saniya
Hi All,
How to write batch ?
I have one object called cash_advance want to create/update(If already exist) balance for all cash advance I written some code but its not creating balances for all cash_advance and I think breaking somewhere in middle and Communication failure no response from server message box popping..

Here is my code


Batch class

global class BatchGenerateBalance implements Database.Batchable <sObject> {
 
    public string selectedYearMonth {get;set;}
    public Decimal d;
    public Set<id> caList {get;set;}
    public List<Balance__c> balanceList=new List<Balance__c>();
    public List<Balance__c> updateBalanceList=new List<Balance__c>();
    
   
        private String query = 'Select Id,Name,Cash_Advance_Number__c,Customer_Number__c,Start_Date__c,Customer_Name__r.Name,Close_Date__c,Customer_Name__r.Trading_Address__c, Customer_Name__r.Email__c, Current_Outstanding__c,Holdback_Percentage__c,Repayment_Amount__c from Cash_Advance__c ';

    
    global void execute(SchedulableContext sc) {
        Database.executebatch(this);
    }

    
    global Database.QueryLocator start(Database.BatchableContext BC) {
      System.debug(query);
        return Database.getQueryLocator(query);
        //System.debug('checkcase---' + query); //debugging
    }

    public BatchGenerateBalance(String selectedYrMnth){
        this.selectedYearMonth = selectedYrMnth;        
    }
    
  
    global void execute(Database.BatchableContext BC, List <sObject> scope) {
        
        List <Cash_Advance__c> cashList = (List <Cash_Advance__c> ) scope; //List of cases
    
        System.debug('Size of cashList'+cashList.size());
        System.debug('checkcase---' + scope); 
        
        
        String sDate = selectedYearMonth;
        String monthName;
        System.debug(sDate);
        Integer month = Integer.valueOf(sDate.substring(5));
        Integer year = Integer.valueOf(sDate.substring(0,4));
        System.debug('month=='+ month);
        System.debug('year =='+ year );
        
        if(month==1)
        {
           monthName='Jan' ;
        }
        else if(month==2)
        {
            monthName='Feb';
        }
         else if(month==3)
        {
            monthName='Mar';
        }
         else if(month==4)
        {
            monthName='Apr';
        }
         else if(month==5)
        {
            monthName='May';
        }
         else if(month==6)
        {
            monthName='Jun';
        }
         else if(month==7)
        {
            monthName='Jul';
        }
         else if(month==8)
        {
            monthName='Aug';
        }
         else if(month==9)
        {
            monthName='Sep';
        }
         else if(month==10)
        {
            monthName='Oct';
        }
         else if(month==11)
        {
            monthName='Nov';
        }
         else if(month==12)
        {
            monthName='Dec';
        }
        
        Integer numberOfDays = Date.daysInMonth(year, month);
        Date firstDayOfMonth = Date.newInstance(year, month, 1);
        Date lastDayOfMonth = Date.newInstance(year, month, numberOfDays); 
        System.debug('Anujit==='+ sDate);
        
        System.debug('no.ofDays=='+ numberOfDays);
        System.debug('1stDay=='+ firstDayOfMonth);
        System.debug('lastDay=='+ lastDayOfMonth);
        
        
        for(Cash_Advance__c ca : cashList){
          String balanceName=ca.Cash_Advance_Number__c+'-'+monthName+''+year;
            List<Balance__c> checkAlreadyExist=[Select id,Date__c,name,Total_Daily_Payments_in_Month__c,Total_Adjustments_in_Month__c,Total_Refunds_in_Month__c,Beginning_Balance__c from balance__c where name=:balanceName and Cash_Advance__c=:ca.id];
            if(checkAlreadyExist.isEmpty())
            {
            Balance__c balance=new balance__c();
            
            balance.Cash_Advance__c=ca.ID;
            if(ca.Cash_Advance_Number__c!='')
            {
                 balance.Name=ca.Cash_Advance_Number__c+'-'+monthName+''+year;
            }
            else
            {
                balance.Name='';
            }
            balance.Date__c=monthName+''+year;
             AggregateResult[] result = [select sum(Payment_Amount__c) repamt,Repayment_Month__c from Repayment__c where Description__c ='Daily Repayment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];
            
            //Summaries = new List<Summary>();
            Map<String,Decimal> DailyMap= new Map<String,Decimal>();           
            for (AggregateResult ar : result) {
                Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
                String repaymentMonth= (String) ar.get('Repayment_Month__c');

                DailyMap.put(repaymentMonth,repaymentAmt);
            }
             //cashAdvance = [Select Id,Customer_Name__c,Amount_Advanced__c  from Cash_Advance__c where Id=:selectedId ];
            AggregateResult[] resultad1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Adjustment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
           
            
            Map<String,Decimal> adjMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultad1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                adjMap.put(repaymentMonth,repaymentAmt);
            }
              AggregateResult[] resultre1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Refund' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
            
            
            Map<String,Decimal> rfundMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultre1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                rfundMap.put(repaymentMonth,repaymentAmt);
            }
                Decimal totalOfAll=0;
             Set<String> yearMonthSet= new Set<String>();
            yearMonthSet.addAll(DailyMap.KeySet());
            yearMonthSet.addAll(adjMap.KeySet());
            yearMonthSet.addAll(rfundMap.KeySet());
            List<String> yearMonthList= new List<String>();
            yearMonthList.addAll(yearMonthSet);
            yearMonthList.sort();
            for(String ym: yearMonthList){ 
                 Decimal d1= DailyMap.get(ym);
                if(d1!= null){
                    Balance.Total_Daily_Payments_in_Month__c = d1;
                }else{
                    Balance.Total_Daily_Payments_in_Month__c =0;
                }
                Decimal d2= adjMap.get(ym);
                if(d2!= null){
                    Balance.Total_Adjustments_in_Month__c = d2;
                }else{
                    Balance.Total_Adjustments_in_Month__c= 0;
                }
                Decimal d3= rfundMap.get(ym);
                if(d3!= null){
                    Balance.Total_Refunds_in_Month__c = d3;
                }else{
                    Balance.Total_Refunds_in_Month__c= 0;
                }
                // Balance.Total_Payments_in_Month__c=(d1==null?0:d1)+(d2==null?0:d2)+(d3==null?0:d3);
                totalOfAll=d1+d2+d3;
                System.debug('Total of all is'+totalOfAll);
            }
             List<Repayment__c> rpmtList1 = [select Repayment_Date__c, Payment_Amount__c,Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth];
        Integer bal=0;
        
        List<Date> prevList = new List<Date>();
        for(Repayment__c rp:rpmtList1 ){
            prevList.add(rp.Repayment_Date__c);
        
        }
        prevList.sort();
        System.debug('BAL=========='+ prevList);
        bal=rpmtList1.size();
        
        if(!prevList.isEmpty()){
            List<Repayment__c> repp = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[0] ORDER BY Previous_Balance__c DESC];
            List<Repayment__c> repp1 = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[bal-1]];
        
            if(!repp.isEmpty()){
                Balance.Beginning_Balance__c = repp[0].Previous_Balance__c;     
                System.debug('OPEN =='+  balance.Beginning_Balance__c );                
            }
            
        

        } 


        else{
          List<Repayment__c> temprpmtList = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c<:firstDayOfMonth ORDER BY Previous_Balance__c ASC];
          if(ca.Current_Outstanding__c == ca.Repayment_Amount__c){
                  balance.Beginning_Balance__c = ca.Repayment_Amount__c;
                  //scc.Ending_Balance__c = ca.Repayment_Amount__c;  
          } else if(temprpmtList.size() != 0){
            balance.Beginning_Balance__c = temprpmtList [0].balance__c;
           // scc.Ending_Balance__c = temprpmtList [0].balance__c;
         } else {
            balance.Beginning_Balance__c = ca.Repayment_Amount__c;
           // scc.Ending_Balance__c = ca.Repayment_Amount__c;   
         }
        }
        
        balanceList.add(Balance);
        
        }
            else
            {
                for(Balance__c updatebal:checkAlreadyExist) 
                {
                         AggregateResult[] result = [select sum(Payment_Amount__c) repamt,Repayment_Month__c from Repayment__c where Description__c ='Daily Repayment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];
            
            //Summaries = new List<Summary>();
            Map<String,Decimal> DailyMap= new Map<String,Decimal>();           
            for (AggregateResult ar : result) {
                Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
                String repaymentMonth= (String) ar.get('Repayment_Month__c');

                DailyMap.put(repaymentMonth,repaymentAmt);
            }
             //cashAdvance = [Select Id,Customer_Name__c,Amount_Advanced__c  from Cash_Advance__c where Id=:selectedId ];
            AggregateResult[] resultad1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Adjustment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth /*and Repayment_Date__c>=:startDate and Repayment_Date__c<=:endDate*/ group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
           
            
            Map<String,Decimal> adjMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultad1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                adjMap.put(repaymentMonth,repaymentAmt);
            }
              AggregateResult[] resultre1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Refund' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth /*and Repayment_Date__c>=:startDate and Repayment_Date__c<=:endDate*/ group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
            
            
            Map<String,Decimal> rfundMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultre1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                rfundMap.put(repaymentMonth,repaymentAmt);
            }
             Set<String> yearMonthSet= new Set<String>();
            yearMonthSet.addAll(DailyMap.KeySet());
            yearMonthSet.addAll(adjMap.KeySet());
            yearMonthSet.addAll(rfundMap.KeySet());
            List<String> yearMonthList= new List<String>();
            yearMonthList.addAll(yearMonthSet);
            yearMonthList.sort();
            for(String ym: yearMonthList){ 
                 Decimal d1= DailyMap.get(ym);
                if(d1!= null){
                    updatebal.Total_Daily_Payments_in_Month__c = d1;
                }else{
                    updatebal.Total_Daily_Payments_in_Month__c =0;
                }
                Decimal d2= adjMap.get(ym);
                if(d2!= null){
                    updatebal.Total_Adjustments_in_Month__c = d2;
                }else{
                    updatebal.Total_Adjustments_in_Month__c= 0;
                }
                Decimal d3= rfundMap.get(ym);
                if(d3!= null){
                    updatebal.Total_Refunds_in_Month__c = d3;
                }else{
                    updatebal.Total_Refunds_in_Month__c= 0;
                }
                // Balance.Total_Payments_in_Month__c=(d1==null?0:d1)+(d2==null?0:d2)+(d3==null?0:d3);
                
            }
             List<Repayment__c> rpmtList1 = [select Repayment_Date__c, Payment_Amount__c,Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth];
        Integer bal=0;
        
        List<Date> prevList = new List<Date>();
        for(Repayment__c rp:rpmtList1 ){
            prevList.add(rp.Repayment_Date__c);
        
        }
        prevList.sort();
        System.debug('BAL=========='+ prevList);
        bal=rpmtList1.size();
        
        if(!prevList.isEmpty()){
            List<Repayment__c> repp = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[0] ORDER BY Previous_Balance__c DESC];
            List<Repayment__c> repp1 = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[bal-1]];
        
            if(!repp.isEmpty()){
                updatebal.Beginning_Balance__c = repp[0].Previous_Balance__c;     
                System.debug('OPEN =='+  updatebal.Beginning_Balance__c );                
            }
            
        

        } 


        else{
          List<Repayment__c> temprpmtList = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c<:firstDayOfMonth ORDER BY Previous_Balance__c ASC];
          if(ca.Current_Outstanding__c == ca.Repayment_Amount__c){
                  updatebal.Beginning_Balance__c = ca.Repayment_Amount__c;
                  //scc.Ending_Balance__c = ca.Repayment_Amount__c;  
          } else if(temprpmtList.size() != 0){
            updatebal.Beginning_Balance__c = temprpmtList [0].balance__c;
           // scc.Ending_Balance__c = temprpmtList [0].balance__c;
         } else {
            updatebal.Beginning_Balance__c = ca.Repayment_Amount__c;
           // scc.Ending_Balance__c = ca.Repayment_Amount__c;   
         }
        }
         updateBalanceList.add(updatebal);
                }
                
            }
       }
        if(!updateBalanceList.isEmpty())
        {
            update updateBalanceList;
            System.debug('Updated All Balances Successfuly');
        }
        if(!balanceList.isEmpty())
        {
            System.debug('Size of Balance List'+balanceList.size());
            insert balanceList;
            System.debug('Inserted All Balances Successfuly');
        }
    }
    global void finish(Database.BatchableContext BC) {

    }
}

Can anyone please help me for this?
Many thanks,
Saniya
While running batch class its creating records but getting communication failure No response from server..
here is my code
The class which calling Batch class
public class GenerateBalanceController {
 public string selectedYearMonth {get;set;} 
    
    
    public GenerateBalanceController(){
        //generate();
    }
      public PageReference go(){
       
             BatchGenerateBalance job = new BatchGenerateBalance(selectedYearMonth);
             Database.executeBatch(job, 10);
             
             PageReference pageRef1 = ApexPages.CurrentPage();
             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Balance are generated succesfully');
             ApexPages.addMessage(myMsg); 
             return pageRef1;
             
         //}   
     }
    
    
       public List<selectOption> getVal() {
        List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
        //options.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
        Date endDate =Date.newInstance(System.today().year(),System.today().month(), 01);
        Date startDate = endDate.addDays(-365);
        
        for (integer i=0;i<=12;i++) { 
            
            Date dt= startDate.addMonths(i); 
            String sDt =dt.year()+'/'+dt.month();
            if(dt.month()<10){
                sDt =dt.year()+'/0'+dt.month();
            }
            options.add(new selectOption(sDt, sDt)); //for all records found - add them to the picklist options
        }
        return options; //return the picklist options
        
     }  
}
Batch class It create balance from cash advance and if its already exist then update it(Just wanted to confirm the records are in  lacs)
global class BatchGenerateBalance implements Database.Batchable <sObject> {
 
    
    public string selectedYearMonth {get;set;}
    public Decimal d;
    public Set<id> caList {get;set;}
    public List<Balance__c> balanceList=new List<Balance__c>();
    public List<Balance__c> updateBalanceList=new List<Balance__c>();
    
   
        private String query = 'Select Id,Name,Cash_Advance_Number__c,Customer_Number__c,Start_Date__c,Customer_Name__r.Name,Close_Date__c,Customer_Name__r.Trading_Address__c, Customer_Name__r.Email__c, Current_Outstanding__c,Holdback_Percentage__c,Repayment_Amount__c from Cash_Advance__c  ';

    
    global void execute(SchedulableContext sc) {
        Database.executebatch(this);
    }

    
    global Database.QueryLocator start(Database.BatchableContext BC) {
      System.debug(query);
        return Database.getQueryLocator(query);
        //System.debug('checkcase---' + query); //debugging
    }

    public BatchGenerateBalance(String selectedYrMnth){
        this.selectedYearMonth = selectedYrMnth;        
    }
    
  
    global void execute(Database.BatchableContext BC, List <sObject> scope) {
        
        List <Cash_Advance__c> cashList = (List <Cash_Advance__c> ) scope; //List of cases
        System.debug('checkcase---' + scope); 
        
        
        String sDate = selectedYearMonth;
        String monthName;
        System.debug(sDate);
        Integer month = Integer.valueOf(sDate.substring(5));
        Integer year = Integer.valueOf(sDate.substring(0,4));
        System.debug('month=='+ month);
        System.debug('year =='+ year );
        
        if(month==1)
        {
           monthName='Jan' ;
        }
        else if(month==2)
        {
            monthName='Feb';
        }
         else if(month==3)
        {
            monthName='Mar';
        }
         else if(month==4)
        {
            monthName='Apr';
        }
         else if(month==5)
        {
            monthName='May';
        }
         else if(month==6)
        {
            monthName='Jun';
        }
         else if(month==7)
        {
            monthName='Jul';
        }
         else if(month==8)
        {
            monthName='Aug';
        }
         else if(month==9)
        {
            monthName='Sep';
        }
         else if(month==10)
        {
            monthName='Oct';
        }
         else if(month==11)
        {
            monthName='Nov';
        }
         else if(month==12)
        {
            monthName='Dec';
        }
        
        Integer numberOfDays = Date.daysInMonth(year, month);
        Date firstDayOfMonth = Date.newInstance(year, month, 1);
        Date lastDayOfMonth = Date.newInstance(year, month, numberOfDays); 
        System.debug('Anujit==='+ sDate);
        
        System.debug('no.ofDays=='+ numberOfDays);
        System.debug('1stDay=='+ firstDayOfMonth);
        System.debug('lastDay=='+ lastDayOfMonth);
        
        
        for(Cash_Advance__c ca : cashList){
          String balanceName=ca.Cash_Advance_Number__c+'-'+monthName+''+year;
            List<Balance__c> checkAlreadyExist=[Select id,Date__c,name,Total_Daily_Payments_in_Month__c,Total_Adjustments_in_Month__c,Total_Refunds_in_Month__c,Beginning_Balance__c from balance__c where name=:balanceName and Cash_Advance__c=:ca.id];
            if(checkAlreadyExist.isEmpty())
            {
            Balance__c balance=new balance__c();
            
            balance.Cash_Advance__c=ca.ID;
            if(ca.Cash_Advance_Number__c!='')
            {
                 balance.Name=ca.Cash_Advance_Number__c+'-'+monthName+''+year;
            }
            else
            {
                balance.Name='';
            }
            balance.Date__c=monthName+''+year;
             AggregateResult[] result = [select sum(Payment_Amount__c) repamt,Repayment_Month__c from Repayment__c where Description__c ='Daily Repayment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];
            
            //Summaries = new List<Summary>();
            Map<String,Decimal> DailyMap= new Map<String,Decimal>();           
            for (AggregateResult ar : result) {
                Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
                String repaymentMonth= (String) ar.get('Repayment_Month__c');

                DailyMap.put(repaymentMonth,repaymentAmt);
            }
             //cashAdvance = [Select Id,Customer_Name__c,Amount_Advanced__c  from Cash_Advance__c where Id=:selectedId ];
            AggregateResult[] resultad1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Adjustment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
           
            
            Map<String,Decimal> adjMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultad1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                adjMap.put(repaymentMonth,repaymentAmt);
            }
              AggregateResult[] resultre1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Refund' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
            
            
            Map<String,Decimal> rfundMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultre1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                rfundMap.put(repaymentMonth,repaymentAmt);
            }
             Set<String> yearMonthSet= new Set<String>();
            yearMonthSet.addAll(DailyMap.KeySet());
            yearMonthSet.addAll(adjMap.KeySet());
            yearMonthSet.addAll(rfundMap.KeySet());
            List<String> yearMonthList= new List<String>();
            yearMonthList.addAll(yearMonthSet);
            yearMonthList.sort();
            for(String ym: yearMonthList){ 
                 Decimal d1= DailyMap.get(ym);
                if(d1!= null){
                    Balance.Total_Daily_Payments_in_Month__c = d1;
                }else{
                    Balance.Total_Daily_Payments_in_Month__c =0;
                }
                Decimal d2= adjMap.get(ym);
                if(d2!= null){
                    Balance.Total_Adjustments_in_Month__c = d2;
                }else{
                    Balance.Total_Adjustments_in_Month__c= 0;
                }
                Decimal d3= rfundMap.get(ym);
                if(d3!= null){
                    Balance.Total_Refunds_in_Month__c = d3;
                }else{
                    Balance.Total_Refunds_in_Month__c= 0;
                }
                // Balance.Total_Payments_in_Month__c=(d1==null?0:d1)+(d2==null?0:d2)+(d3==null?0:d3);
                
            }
             List<Repayment__c> rpmtList1 = [select Repayment_Date__c, Payment_Amount__c,Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth];
        Integer bal=0;
        
        List<Date> prevList = new List<Date>();
        for(Repayment__c rp:rpmtList1 ){
            prevList.add(rp.Repayment_Date__c);
        
        }
        prevList.sort();
        System.debug('BAL=========='+ prevList);
        bal=rpmtList1.size();
        
        if(!prevList.isEmpty()){
            List<Repayment__c> repp = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[0] ORDER BY Previous_Balance__c DESC];
            List<Repayment__c> repp1 = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[bal-1]];
        
            if(!repp.isEmpty()){
                Balance.Beginning_Balance__c = repp[0].Previous_Balance__c;     
                System.debug('OPEN =='+  balance.Beginning_Balance__c );                
            }
            
        

        } 


        else{
          List<Repayment__c> temprpmtList = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c<:firstDayOfMonth ORDER BY Previous_Balance__c ASC];
          if(ca.Current_Outstanding__c == ca.Repayment_Amount__c){
                  balance.Beginning_Balance__c = ca.Repayment_Amount__c;
                  //scc.Ending_Balance__c = ca.Repayment_Amount__c;  
          } else if(temprpmtList.size() != 0){
            balance.Beginning_Balance__c = temprpmtList [0].balance__c;
           // scc.Ending_Balance__c = temprpmtList [0].balance__c;
         } else {
            balance.Beginning_Balance__c = ca.Repayment_Amount__c;
           // scc.Ending_Balance__c = ca.Repayment_Amount__c;   
         }
        }

        balanceList.add(Balance);
        }
            else
            {
                for(Balance__c updatebal:checkAlreadyExist) 
                {
                         AggregateResult[] result = [select sum(Payment_Amount__c) repamt,Repayment_Month__c from Repayment__c where Description__c ='Daily Repayment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth  group by Repayment_Month__c ORDER BY Repayment_Month__c];
            
            //Summaries = new List<Summary>();
            Map<String,Decimal> DailyMap= new Map<String,Decimal>();           
            for (AggregateResult ar : result) {
                Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
                String repaymentMonth= (String) ar.get('Repayment_Month__c');

                DailyMap.put(repaymentMonth,repaymentAmt);
            }
             //cashAdvance = [Select Id,Customer_Name__c,Amount_Advanced__c  from Cash_Advance__c where Id=:selectedId ];
            AggregateResult[] resultad1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Adjustment' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth /*and Repayment_Date__c>=:startDate and Repayment_Date__c<=:endDate*/ group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
           
            
            Map<String,Decimal> adjMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultad1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                adjMap.put(repaymentMonth,repaymentAmt);
            }
              AggregateResult[] resultre1 = [select sum(Payment_Amount__c) repamt, Repayment_Month__c from Repayment__c where Description__c ='Refund' and Cash_Advance__c=:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth /*and Repayment_Date__c>=:startDate and Repayment_Date__c<=:endDate*/ group by Repayment_Month__c ORDER BY Repayment_Month__c];  
        
            
            
            Map<String,Decimal> rfundMap= new Map<String,Decimal>();           
            for (AggregateResult ar : resultre1 ) {
             Decimal repaymentAmt= (Decimal)(ar.get('repamt'));
             String repaymentMonth= (String) ar.get('Repayment_Month__c');

                rfundMap.put(repaymentMonth,repaymentAmt);
            }
             Set<String> yearMonthSet= new Set<String>();
            yearMonthSet.addAll(DailyMap.KeySet());
            yearMonthSet.addAll(adjMap.KeySet());
            yearMonthSet.addAll(rfundMap.KeySet());
            List<String> yearMonthList= new List<String>();
            yearMonthList.addAll(yearMonthSet);
            yearMonthList.sort();
            for(String ym: yearMonthList){ 
                 Decimal d1= DailyMap.get(ym);
                if(d1!= null){
                    updatebal.Total_Daily_Payments_in_Month__c = d1;
                }else{
                    updatebal.Total_Daily_Payments_in_Month__c =0;
                }
                Decimal d2= adjMap.get(ym);
                if(d2!= null){
                    updatebal.Total_Adjustments_in_Month__c = d2;
                }else{
                    updatebal.Total_Adjustments_in_Month__c= 0;
                }
                Decimal d3= rfundMap.get(ym);
                if(d3!= null){
                    updatebal.Total_Refunds_in_Month__c = d3;
                }else{
                    updatebal.Total_Refunds_in_Month__c= 0;
                }
                // Balance.Total_Payments_in_Month__c=(d1==null?0:d1)+(d2==null?0:d2)+(d3==null?0:d3);
                
            }
             List<Repayment__c> rpmtList1 = [select Repayment_Date__c, Payment_Amount__c,Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c>=:firstDayOfMonth and Repayment_Date__c<=:lastDayOfMonth];
        Integer bal=0;
        
        List<Date> prevList = new List<Date>();
        for(Repayment__c rp:rpmtList1 ){
            prevList.add(rp.Repayment_Date__c);
        
        }
        prevList.sort();
        System.debug('BAL=========='+ prevList);
        bal=rpmtList1.size();
        
        if(!prevList.isEmpty()){
            List<Repayment__c> repp = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[0] ORDER BY Previous_Balance__c DESC];
            List<Repayment__c> repp1 = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c=:prevList[bal-1]];
        
            if(!repp.isEmpty()){
                updatebal.Beginning_Balance__c = repp[0].Previous_Balance__c;     
                System.debug('OPEN =='+  updatebal.Beginning_Balance__c );                
            }
            
        

        } 


        else{
          List<Repayment__c> temprpmtList = [select Repayment_Date__c, Previous_Balance__c,Balance__c from Repayment__c where Cash_Advance__c =:ca.Id and Repayment_Date__c<:firstDayOfMonth ORDER BY Previous_Balance__c ASC];
          if(ca.Current_Outstanding__c == ca.Repayment_Amount__c){
                  updatebal.Beginning_Balance__c = ca.Repayment_Amount__c;
                  //scc.Ending_Balance__c = ca.Repayment_Amount__c;  
          } else if(temprpmtList.size() != 0){
            updatebal.Beginning_Balance__c = temprpmtList [0].balance__c;
           // scc.Ending_Balance__c = temprpmtList [0].balance__c;
         } else {
            updatebal.Beginning_Balance__c = ca.Repayment_Amount__c;
           // scc.Ending_Balance__c = ca.Repayment_Amount__c;   
         }
        }
         updateBalanceList.add(updatebal);
                }
                
            }
       }
        if(!updateBalanceList.isEmpty())
        {
            update updateBalanceList;
            System.debug('Updated All Balances Successfuly');
        }
        if(!balanceList.isEmpty())
        {
            insert balanceList;
            System.debug('Inserted All Balances Successfuly');
        }
    }
    global void finish(Database.BatchableContext BC) {

    }
}

Could anyone please help me with this..
Many thanks,
Saniya
 
Hi All,
I want to update a Lead and team member object depending upon some condition on before update trigger   but its working perfectly for on e record and fails for more than 100 records showing too many SOQL records on line 23 here is my code

public class AllocateTeamMemberHandler {
    
 public static void allocateTeamMember(List<Lead> leadList)
    {
        set<id> LeadId=new Set<id>();
        Map<id,Lead> LeadMap=new Map<id,Lead>();
        Map<id,Team_Member__c> TeamMap=new Map<id,Team_Member__c>();
        List <Team_Member__c> updateTeamMember=new List<Team_Member__c>();
       Boolean Flag=false;
        for(Lead uplead:leadList)
        {
            if(uplead.Allocate_Team_Member__c!=false)
            {
                System.debug('I am in 1st Lead for loop');
                LeadId.add(uplead.OwnerId);
                LeadMap.Put(uplead.OwnerId,uplead);
                flag=true;
            }
        }
        if(flag!=false)
        {
            System.debug('I am in If ');
        List<Team_Member__c> teamMemberList=[Select id, User_ID__c, Queue_ID__c, Last_Allocated__c, Availability__c from Team_Member__c where Queue_ID__c IN :LeadId and Availability__c = 'Yes' ORDER BY Last_Allocated__c ASC limit 1];
            System.debug('Size of Team List is'+teamMemberList.size());
        For(Team_Member__c team:teamMemberList)
        {
            System.debug('I am in team for loop');
            updateTeamMember.add(new Team_Member__c(Id=team.id,Last_Allocated__c=System.now()));
            TeamMap.put(team.Queue_ID__c,team);
        }
        For(Lead changLead:leadList)
        {
            if(TeamMap.containsKey(changLead.OwnerId))
            {
                System.debug('I am in if of 2nd Lead for loop');
                changLead.OwnerId=TeamMap.get(changLead.OwnerId).User_ID__c;
                changLead.Allocate_Team_Member__c=false;
            }
        }
        if(updateTeamMember.size()>0)
        {
            update updateTeamMember;
        }
      } 
      }
}
Could anyone please help me wuth this..
Many Thanks,
Saniya
Hi,
I am new to the salesforce. Wanted to use inline edit with custom object recode but got stuck anybody please fhelp me.
Here is my code

Visual Force page
<apex:page controller="projectDisplay" >
    <apex:form >
    <apex:pageBlock >
     <apex:pageBlockButtons >
                 <apex:commandButton value="Save" action="{!SaveProject}"/>
             </apex:pageBlockButtons>
                 
            
        <apex:pageBlockSection title="Enter Project Details" collapsible="false" columns="1">
        
              <apex:inputField value="{!proj.name}"/>
              <apex:inputField value="{!proj.Status__c}"/>
              <apex:inputField value="{!proj.Start_Date__c}"/>
              <apex:inputField value="{!proj.ExpectedEndDate__c}"/>
              <apex:inputField value="{!proj.ActualEndDate__c}"/>
                   
        </apex:pageBlockSection>
        </apex:pageBlock>
            </apex:form>
  <apex:form >  
<apex:pageBlock mode="inlineEdit" >
    <apex:pageBlockSection title="Project Details" >
        
        <apex:pageBlockTable value="{!project}" var="p" align="center">
            <apex:column >
             <apex:commandLink action="{!deleteProject}" value="Del" >
                        <apex:param value="{!p.id}" name="column" assignTo="{!selectedLineDel}" ></apex:param>
                    </apex:commandLink>
            </apex:column>
            <apex:column >
             <apex:commandLink action="{!updateProject}" value="Edit" >
                        <apex:param value="{!p.id}" name="column" assignTo="{!selectedLineEdit}" ></apex:param>
                    </apex:commandLink>
            </apex:column>

               <apex:column value="{!p.name}"/>
             <apex:column value="{!p.Status__c}"/>
            <apex:column value="{!p.Start_Date__c}"/>
            <apex:column value="{!p.ExpectedEndDate__c}"/>
            <apex:column value="{!p.ActualEndDate__c}"/>
            
            </apex:pageBlockTable>        
       <!--  <apex:inlineEditSupport />
           <apex:commandButton value="Save All " action="{!QuickSave}"/>-->
        
        </apex:pageBlockSection>
    
    </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Code

public class projectDisplay {
    
public project__c proj { get; set; }
public project__c project { get; set; }
 public List<Project__c> p ;
public String selectedLineDel{get;set;}  
public String selectedLineEdit{get;set;}
public String name{get;set;}
    
    public List<Project__c> getproject()
    {
        
        p=[select Name,ExpectedEndDate__c,ActualEndDate__c,Start_Date__c,Status__c from Project__c];
        return p;
    }
    
    //inline Delete
    public pageReference deleteProject()
    {
        Project__c pd=[select id from Project__c where id=:selectedLineDel];
        delete pd;
        return null;
    }
    //inline Update
    public pageReference updateProject()
    {
      List<project__c> edit=new List<Project__c>();
        List<Project__c> pedit=[select Name,ExpectedEndDate__c,ActualEndDate__c,Start_Date__c,Status__c from Project__c where id=:selectedLineedit];
       for(Project__c pe:pedit)
        {
           pe.Name=project.Name;
            pe.ActualEndDate__c=project.ActualEndDate__c;
            pe.ExpectedEndDate__c=project.ExpectedEndDate__c;
            pe.Start_Date__c=project.Start_Date__c;
            pe.Status__c=project.Status__c;
            edit.add(pe);
        }
        update edit;
        return null;
    }
    
    //constructor
    public projectDisplay(){
        proj=new Project__c();
    }
    
    //insert Project Record
    public pageReference saveProject()
    {
        
        insert proj;
        return null;
    }
        
}
 
Hi All,
I am trying to integrate workday with salesforce by using wsdl classes but I am getting above error.
could anyone please help me with this.

Here is my code
public class Revenue_Management {
        public String endpoint_x = 'https://wd3-impl-services1.workday.com/ccx/service/chime5/Revenue_Management/v31.1';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};
    public comWorkdayBsvc.Submit_Customer_Invoice_ResponseType Submit_Customer_Invoice(comWorkdayBsvc.Customer_InvoiceObjectType Customer_Invoice_Reference,comWorkdayBsvc.Financials_Business_Process_ParametersType Business_Process_Parameters,comWorkdayBsvc.Customer_Invoice_WWS_DataType Customer_Invoice_Data) {
            comWorkdayBsvc.Submit_Customer_Invoice_RequestType request_x = new comWorkdayBsvc.Submit_Customer_Invoice_RequestType();
            comWorkdayBsvc.Submit_Customer_Invoice_ResponseType response_x;
            request_x.Customer_Invoice_Reference = Customer_Invoice_Reference;
            request_x.Business_Process_Parameters = Business_Process_Parameters;
            request_x.Customer_Invoice_Data = Customer_Invoice_Data;
           
            Blob headerValue = Blob.valueOf('xxx.sxxxx@xxx5' + ':' + 'xxxxx');

            String authorizationHeader = 'Basic ' +EncodingUtil.base64Encode(headerValue);

          //  String sURL = 'https:/testURL';

            System.debug('***authorizationHeader***'+authorizationHeader);

            this.inputHttpHeaders_x = new Map<String,String>();

            //response_x.inputHttpHeaders_x.put('URL',sURL);       

            this.inputHttpHeaders_x.put('Authorization',authorizationHeader);
            
            Map<String, comWorkdayBsvc.Submit_Customer_Invoice_ResponseType> response_map_x = new Map<String, comWorkdayBsvc.Submit_Customer_Invoice_ResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'urn:com.workday/bsvc',
                'Submit_Customer_Invoice_Request',
                'urn:com.workday/bsvc',
                'Submit_Customer_Invoice_Response',
                'comWorkdayBsvc.Submit_Customer_Invoice_ResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }

        
Hi All,
I got an requirement in which want to display campaign member and its partner status of perticuler event in one vf page.
and each event have 1000's of campaign member and want to display campaign member details and its partner details.
I am using wrapper class for this so I can combine the campaign member details and its partner details in one page .
but in for loap when I try to retrieve partner details from its throwing an  error of so many query.

How to deal with this?
Any help will be appreciated.
Many thanks,
Saniya

 
Hi All,
I am trying to integrate salesforce with workday.
I tried with SoapUI APP for testing and its working fine but when I tried same xml in apex class using HTTPrequest its not working and throwing an error Invalid request.
Could anyone pleasde help me with this it will be appreciates.

Here is my apex code with xml string

public class Test2 {
   public static void test_m(){
     String body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc">'+
           '<soapenv:Header>' +
              '<bsvc:Workday_Common_Header>' +
                 '<bsvc:Include_Reference_Descriptors_In_Response>'+'1'+'</bsvc:Include_Reference_Descriptors_In_Response>' +
              '</bsvc:Workday_Common_Header>' +
           '</soapenv:Header>' +
           '<soapenv:Body>' +
              '<bsvc:Get_Customer_Invoices_Request bsvc:version="v31.1">' +
                 '<bsvc:Request_References>' +
                    '<bsvc:Customer_Invoice_Reference bsvc:Descriptor="?">' +
                       '<bsvc:ID bsvc:type="WID">a36116d317ae81ecf995ece9cxxxxxxx</bsvc:ID>' +
                    '</bsvc:Customer_Invoice_Reference>' +
                               '</bsvc:Get_Customer_Invoices_Request>' +
           '</soapenv:Body>' +
        '</soapenv:Envelope>';
       System.debug('Message'+body);
    HTTP h = new HTTP();
    HTTPRequest r = new HTTPRequest();
    r.setEndpoint('https://wd3-impl-services1.workday.com/ccx/service/XXX/Revenue_Management/v31.1');
    Blob headerValue = Blob.valueOf('ISU_XXXX_XXx@tenent' + ':' + 'XXXXX!');
   String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
    r.setHeader('Authorization', authorizationHeader);
    r.setHeader('Content-Type','text/xml;charset=UTF-8');
    r.setHeader('AllowAutoRedirect', 'True');
    r.setHeader('UseDefaultCredentials','False'); 
      r.setHeader('AuthenticationLevel', 'Net.Security.AuthenticationLevel.None');
       r.setHeader('SOAPAction', 'https://wd3-impl-services1.workday.com/ccx/service/xxx/Revenue_Management/v31.1');
    r.setMethod('GET');
    r.setBody(body);
    HTTPResponse resp = h.send(r);
    system.debug('Body::'+resp.getbody());
 }
}
Many thanks,
Saniya
Hi All,
I am trying to connect salesforce and workday customer invoices.
I can able to connect get_customer_invoice function via SOAPUI App but unfortunatly can't able with salesforce by using apex2wsdl class the only hing which I am not seting in httpinputheader is wss-passwordtype which I am setting in SOAPUI.
And its throwing invalid username or password.
I think reson for this error is I am not setting wss pasword type.Can anyone please help me with this.
 public String endpoint_x = 'https://wd3-impl-services1.workday.com/ccx/service/xxxx/Revenue_Management/v31.1';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};
            
Many Thanks,
Saniya
Hi All,
I generated the apex classes from wsdl but didn't know how to specify credential.
here is code for that 
public class Revenue_Management {
        public String endpoint_x = 'Revenue_Management';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:com.workday/bsvc','comWorkdayBsvc'};

        public comWorkdayBsvc.Cash_SaleObjectType Cancel_Cash_Sale(comWorkdayBsvc.Cash_SaleObjectType Cash_Sale_Reference) {
            comWorkdayBsvc.Cancel_Cash_Sale_RequestType request_x = new comWorkdayBsvc.Cancel_Cash_Sale_RequestType();
            comWorkdayBsvc.Cancel_Cash_Sale_ResponseType response_x;
            request_x.Cash_Sale_Reference = Cash_Sale_Reference;
            Map<String, comWorkdayBsvc.Cancel_Cash_Sale_ResponseType> response_map_x = new Map<String, comWorkdayBsvc.Cancel_Cash_Sale_ResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'urn:com.workday/bsvc',
                'Cancel_Cash_Sale_Request',
                'urn:com.workday/bsvc',
                'Cancel_Cash_Sale_Response',
                'comWorkdayBsvc.Cancel_Cash_Sale_ResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Cash_Sale_Reference;
        }

It will will be grat if anyone will help me.

Many Thanks,
Saniya
Hi All,
I want to integrate workday with salesforce and using Revenue_Managment service.So  I downloaded its wsdl file which is Revenue_Managment.wsdl but while parsing it showing an error.
Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute. At: 119:74

Could anyone please help me with this.

Many Thanks,
Saniya
Hi guys,
How we can integrate salesforce with workday?
any help will be appretiated..

Many Thanks,
Saniya
Hi All,
I want to update a Lead and team member object depending upon some condition on before update trigger   but its working perfectly for on e record and fails for more than 100 records showing too many SOQL records on line 23 here is my code

public class AllocateTeamMemberHandler {
    
 public static void allocateTeamMember(List<Lead> leadList)
    {
        set<id> LeadId=new Set<id>();
        Map<id,Lead> LeadMap=new Map<id,Lead>();
        Map<id,Team_Member__c> TeamMap=new Map<id,Team_Member__c>();
        List <Team_Member__c> updateTeamMember=new List<Team_Member__c>();
       Boolean Flag=false;
        for(Lead uplead:leadList)
        {
            if(uplead.Allocate_Team_Member__c!=false)
            {
                System.debug('I am in 1st Lead for loop');
                LeadId.add(uplead.OwnerId);
                LeadMap.Put(uplead.OwnerId,uplead);
                flag=true;
            }
        }
        if(flag!=false)
        {
            System.debug('I am in If ');
        List<Team_Member__c> teamMemberList=[Select id, User_ID__c, Queue_ID__c, Last_Allocated__c, Availability__c from Team_Member__c where Queue_ID__c IN :LeadId and Availability__c = 'Yes' ORDER BY Last_Allocated__c ASC limit 1];
            System.debug('Size of Team List is'+teamMemberList.size());
        For(Team_Member__c team:teamMemberList)
        {
            System.debug('I am in team for loop');
            updateTeamMember.add(new Team_Member__c(Id=team.id,Last_Allocated__c=System.now()));
            TeamMap.put(team.Queue_ID__c,team);
        }
        For(Lead changLead:leadList)
        {
            if(TeamMap.containsKey(changLead.OwnerId))
            {
                System.debug('I am in if of 2nd Lead for loop');
                changLead.OwnerId=TeamMap.get(changLead.OwnerId).User_ID__c;
                changLead.Allocate_Team_Member__c=false;
            }
        }
        if(updateTeamMember.size()>0)
        {
            update updateTeamMember;
        }
      } 
      }
}
Could anyone please help me wuth this..
Many Thanks,
Saniya

According to the SF documentation attributes are supported  in when generating classes from wsdl schemas.    Anyone know attributes generate errors on

New Apex Code from WSDL

 

<xs:attribute name="name" type = "xs:string"/>

 

-Thanks

Does anyone have a sample of Apex to workday?

WSDL2Apex creates the classes for me just fine but the Authentication class doesn't look complete, no password member.

 

Thanks.

  • February 09, 2011
  • Like
  • 0