• nishant shrivastava 40
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 11
    Replies

#Sales Cloud#Batch Apex Class

I have a batch class and it throws an error for different picklist value assignment. Invalid integer whereas those fields are picklist and should be dealt as text field.
Please check the class...
Error 1 : invalid integer for 'noch k.A' & '6-25' and so on.
Error 2 : it is also not updating the field partially. no partial success.
Error 3. It's not triggering an email from Finish method. i tried then in execute method. it does not trigger there as well.

I shall be grateful to you for your kind cooperation. Thanks in advance.

global class PicklistCleaning implements Database.Batchable<sObject>, database.stateful {
    Exception[] errors = new Exception[0];
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // collect the batches of records or objects to be passed to execute
        string Query = 'select NoOfEmployees__c from Account where NoOfEmployees__c !=\'noch k. A.\' AND NoOfEmployees__c !=\'1 - 5\' AND NoOfEmployees__c !=\'6 - 25\'AND NoOfEmployees__c !=\'26 - 50\' AND NoOfEmployees__c !=\'51 - 250\' AND NoOfEmployees__c !=\'251 - 500\' AND NoOfEmployees__c !=\'501 - 1.000\' AND NoOfEmployees__c !=\'1001 - 9999\' AND NoOfEmployees__c !=\'> 10.000\'';
        system.debug(Query);
            return database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext bc, List<Account> records){
        // process each batch of records
        List<Account> Acclist = New List<Account>();
        for(Account Acc : records){
            if(acc.NoOfEmployees__c == null || acc.NoOfEmployees__c == ''){ 
                acc.NoOfEmployees__c = 'noch k. A.';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=5 || integer.valueof(acc.NoOfEmployees__c) == 1){
                acc.NoOfEmployees__c = '1 - 5';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=25 || integer.valueof(acc.NoOfEmployees__c) >= 6){
                acc.NoOfEmployees__c = '6 - 25';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=50 || integer.valueof(acc.NoOfEmployees__c) >= 26){
                acc.NoOfEmployees__c = '26 - 50';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=250 || integer.valueof(acc.NoOfEmployees__c) >= 51){
                acc.NoOfEmployees__c = '51 - 250';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=500 || integer.valueof(acc.NoOfEmployees__c) >= 251){
                acc.NoOfEmployees__c = '251 - 500';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=1000 || integer.valueof(acc.NoOfEmployees__c) >= 501){
                acc.NoOfEmployees__c = '501 - 1.000';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=9999 || integer.valueof(acc.NoOfEmployees__c) >= 1001){
                acc.NoOfEmployees__c = '1001 - 9999';
            }
            if(integer.valueof(acc.NoOfEmployees__c) >=10000){
                acc.NoOfEmployees__c = '> 10.000';
            }
            Acclist.add(acc);
        }
        try{
           Database.upsert(Acclist, false);
           Database.SaveResult[] sr = Database.update(Acclist, false);
            for(Database.SaveResult srr :  sr){
                if(srr.isSuccess()){
                    system.debug(srr.getId());
                }
                else{
                    for(Database.Error err : srr.getErrors()){
                        system.debug(err.getFields());
                        system.debug(err.message);
                        system.debug(err.getMessage());
                    }
                }
            }
        }
        catch(system.dmlexception e){
            errors.add(e);
            if(!errors.isEmpty()){
           Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
           string[] adds = new string[]{'////@test.com///'};
            mail.setSubject('Errors occurred during batch process.');
            mail.setPlainTextBody(''+errors);
            mail.setToaddresses(adds);
             List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
             mails.add(mail);
            if(mails.size() > 0){
                Messaging.sendEmail(mails);
            }
       }
        }
    }    
    global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
         if(!errors.isEmpty()){
           Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
           string[] adds = new string[]{'///////@test.com///'};
            mail.setSubject('Errors occurred during batch process.');
            mail.setPlainTextBody(''+errors);
            mail.setToaddresses(adds);
             List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
             mails.add(mail);
            if(mails.size() > 0){
                Messaging.sendEmail(mails);
            }
       }
    }    
}
Hi,
kindly have a look of button number 1 which calls button number2 and i need to pass id from button 1 to button 2.

Button 1:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
var id= '{!Account.Id}';
var ids = sforce.apex.execute('CreateContract','CreateRecord',{recId :id});
alert(ids);
function openConga(){
window.open('{!URLFOR($Action.Contract.CreatesContracts, Contract.Id)}','_blank');
}
window.open(openConga());

button 2  (name=createscontracts):
/apex/APXTConga4__Conga_Composer
?serverUrl={!API.Partner_Server_URL_370}
&id={!Contract.Id}
&TemplateId=a0M1w000001uSspEAE
&SC0=1
&SC1=Attachments
&AttachmentParentID={!Contract.Id}


while calling the button number 2, it shows the id null in conga url for (contract.Id). 
could you please assist me, how can i pass id from first javascript button to another one and can get the value for contract.id in conga url.

I shall be grateful to you for your kind assistance.
Thanks and regards
Hi,
I have a requirement where i want to call Custom button from Apex class. kindly suggest. 
I shall be grateful to you for your kind cooperation.
Thanks and regards
Hi,
i have a requirement, if first command button value 'check mapping for Attendee' is click, it should render a new button namely 'Import Attendee'. The problem is when i click first button if hundred times, it keeps the value of input file but when new rerender button got visible 'Import Attendee'. This button does not work on the same file. if i remove rerendered attributes from the 'Import Attendee' button. it works on input file as expected. but i want to show it after first button 'Check mapping for Attendee' clicked. I shall be grateful to you for your kind cooperation. Thanks in Advance.
i am getting for the rerendered attribute (attendee==true) from controller.

<apex:page standardController="ClickmeetingAttendee__c" extensions="ImportDataFromCSVController" title="Import Attendees Customers">
    <apex:form enctype="multipart/form-data">
        <apex:actionRegion>
            <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}" id="In"/>
        </apex:actionRegion>
        <apex:pageBlock id="D">
            <apex:actionRegion immediate="true" renderRegionOnly="true">
            <apex:pageBlockSection columns="4">
                  <apex:commandButton value="Check Mapping for Attendee" action="{!importCSVFileAttendee}"/>
                  <apex:commandButton value="Check Mapping for Register" action="{!importCSVFileRegister}"/>
            </apex:pageBlockSection>
            <apex:pageblockTable value="{!CMAlistattendee}" var="AttendeeHeader" id="A" rendered="{!attendee==true}"> <!---- rendered="{!attendee==true}"----->
                <apex:column value="{!AttendeeHeader.Login__c}" headerValue="Login"/>
                <apex:column value="{!AttendeeHeader.E_mail__c}" rendered="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}" headerValue="Email"/>
                <apex:column value="{!AttendeeHeader.Starts_at__c}" headerValue="Starts At"/>
                <apex:column value="{!AttendeeHeader.Ends_at__c}" headerValue="Ends At"/>
                <apex:column value="{!AttendeeHeader.Rating_comment__c}" headerValue="Rating Comment"/>
                <apex:column value="{!AttendeeHeader.Role__c}" headerValue="Role"/>
                <apex:column value="{!AttendeeHeader.Device__c}" headerValue="Device"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
            <apex:pageblockTable value="{!CMAlistsRegister}" var="AttendeeHeader" id="B" rendered="{!Register==true}">
                <apex:column value="{!AttendeeHeader.Room_ID__c}" headerValue="Room ID"/>
                <apex:column value="{!AttendeeHeader.Room_URL__c}" headerValue="Room URL"/> <!-----rendered ="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}"------>
                <apex:column value="{!AttendeeHeader.HTTP_Referer__c}" headerValue="HTTP Referer"/>
                <apex:column value="{!AttendeeHeader.Country__c}" headerValue="Country"/>
                <apex:column value="{!AttendeeHeader.City__c}" headerValue="City"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Registration_Date__c}" headerValue="Registration Date"/>
                <apex:column value="{!AttendeeHeader.Login_Url__c}" headerValue="Login URL"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
                <apex:pageBlockSection>
                <apex:commandButton value="Import Attendee" action="{!importCSVFile}" rendered="{!attendee==true}"/> <!---rendered="{!Attendee==true}"---->
                </apex:pageBlockSection>
            <apex:pageBlockSection>
                <apex:commandButton value="Import Registered User" action="{!importCSVFiles}" rendered="{!register==true}"/><!------ rendered="{!register==true}"----->
            </apex:pageBlockSection>
            <apex:image rendered="{!flag==true}" value="{!URLFOR($Resource.WellDone)}"/>
            <apex:image rendered="{!flags==true}" value="{!URLFOR($Resource.Excitedkid)}"/>
            <apex:pageMessages />
            </apex:actionRegion>
        </apex:pageBlock>
   </apex:form>
</apex:page>



Thanks :)
Hi,
i have implemented a trigger and a handler class which work after update and it creates a new record. This trigger works only for some users not for all users. I checked the permission things, did not get any clue. I also changed the class to 'without sharing' but it also does not work.
I want it to work for all users irrespective permission, hiearchy etc.
i am unable to understand. what's going wrong. kindly suggest.

Trigger
---------------------------
trigger TransferSAASRecord on Opportunity (after insert, after update) {
    if(trigger.isafter && trigger.isupdate && TransferSAASRecordHandler.firstRun){
          TransferSAASRecordHandler.newInititationOpp(Trigger.new);
          TransferSAASRecordHandler.firstRun = false;
}
    if(trigger.isafter && trigger.isinsert){
        TransferSAASRecordHandler.sendNotification(trigger.new);
    }
}


Apex Class : 

public without sharing class TransferSAASRecordHandler {
    public static boolean firstRun = true;
    public static void newInititationOpp(List<opportunity>Opp){
        List<opportunity>newInitOpp = new List<opportunity>();
        set<id> ids = new set<id>();
        for(opportunity oldopp : opp){
            ids.add(oldopp.Id);
        }
        for(Opportunity o: [select id, name, stageName, ownerId, createdDate, FC_Opportunity_Status__c, RecordtypeId, recordtype.name, ForecastCategoryName,sekund_re_Leadquelle__c, terti_re_Leadquelle__c, closeDate, leadsource, AccountId, Account.name, currencyIsoCode, kommentar_zur_phase__c, LostReason__c, BDR_Recyceln__c, PrimaryContact__c from Opportunity where recordtype.name =: 'SAAS' AND Id IN: ids ]){
            if(o.stageName == 'Geschlossene und gewonnene' && o.RecordType.name == 'SAAS' && o.FC_Opportunity_Status__c == 'New Licence' ){
                Opportunity oppty = new opportunity();
                oppty.Name = O.Account.Name +' ' + 'Media';
                string S = oppty.Name;
                system.debug(S);
                //oppty.RecordType.name = 'Initiation';0122p000000t5g4AAA
                oppty.RecordTypeId = '0122p000000t5g4AAA';
                oppty.StageName = 'Pre Analysis';
                oppty.LostReason__c = o.LostReason__c;
                oppty.Kommentar_zur_Phase__c = o.Kommentar_zur_Phase__c;
                oppty.CloseDate = o.CloseDate.addmonths(2);
                //Oppty.BDR_Recyceln__c = o.BDR_Recyceln__c;
                //oppty.Account.name = o.Account.name;
                oppty.AccountId = o.AccountId;
                oppty.CurrencyIsoCode = o.CurrencyIsoCode;
                //oppty.Name = o.Name;
                oppty.ForecastCategoryName = o.ForecastCategoryName;
                oppty.LeadSource = o.LeadSource;
                oppty.sekund_re_Leadquelle__c = o.sekund_re_Leadquelle__c;
                oppty.terti_re_Leadquelle__c = o.terti_re_Leadquelle__c;
                oppty.OwnerId = '0052p000009pHKVAA2';//'0052p000009pHKVAA2';
                oppty.PrimaryContact__c = o.PrimaryContact__c;
                newInitOpp.add(oppty);
                system.debug(NewInitOpp);
                /*
                 *
  
  Close Date: "CloseDate of original Opp + 2 Months" 0060E00000o5MlhQAE
  Lead Source: Copy from original Opp
  Sec. Lead Source: Copy from original Opp
  Tertery Lead Source: Copy from original Opp
  Primary Contact: Copy from original Opp
  Currency: Copy from original Opp
 */
            }
        }
        try{
            insert newInitOpp;
            system.debug(newInitOpp);
        }
        catch(system.DmlException e){
            system.Debug(e);
        }
        
        set<Id> idss = new set<id>();
        string s;
        for(opportunity createdOpp : NewInitOpp){
            idss.add(createdOpp.id);
            s = createdopp.Id;
            string ManagerEmail = createdOpp.Owner.Manager.Email;
        }
        if(NewInitOpp.size()>0){
                 List<Messaging.SingleEmailMessage> mails = new
      List<Messaging.SingleEmailMessage>();
                 String body = 'A new opportunity was created. kindly click on this link https://XXXXXXXX.lightning.force.com/lightning/r/Opportunity/'+ s +'/view';
            for(Id oppId : Idss){
                string email = oppId;
                string[] toaddresses =  new string[]{'XXXXXXXXXXXX'};//[select email from user where username like '%nishant%'];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setToAddresses(toaddresses);
                mail.setSubject('Automated email: Opportunity created');
                mail.setPlainTextBody(body);
                mails.add(mail);
            }
            if(mails.size() > 0){
                Messaging.sendEmail(mails);
            }
            }
    }
    
    public static void sendNotification(List<opportunity>Opp){
        string s;
        set<id> ids = new set<id>();
        for(opportunity oldopp : opp){
            ids.add(oldopp.Id);
            s = oldopp.id;
        }
        system.debug(opp);
        List<feeditem>notify = new list<feeditem>();
        for(Opportunity o: Opp){
            system.debug(o);
            if(o.OwnerId=='0052p000009pHKVAA2' && O.RecordTypeId == '0122p000000t5g4AAA'){
            feeditem sendnotification = new feeditem();
            sendnotification.parentId = o.Id;
            sendnotification.body = 'Hello,the following Opportunity https://XXXXXXXXXX.lightning.force.com/lightning/r/Opportunity/'+ s + '/view is created. Please have a look and assign it to one of your Team Members, to start Sales Process. ';
            sendnotification.Title = o.name;
            sendnotification.createdbyId = o.OwnerId;
            //sendnotification.LinkUrl = 
            notify.add(sendnotification);
            system.debug(Notify);
          }
        }
        try{
            insert notify;
            system.debug(notify);
        }
        catch(system.DmlException e){
            system.Debug(e);
        }
        
}
      public void sendNotificationReminder(){
        List<feeditem>notify = new list<feeditem>();
        List<opportunity> opp = [select id, CreatedbyId, name, ownerId, RecordtypeId from Opportunity where recordtype.name =: 'Initiation']; 
            string s;
            //for(opportunity opps : Opp){
              //  s = opps.Id;
           // }
        for(Opportunity o: Opp){
            if(o.OwnerId=='0052p000009pHKVAA2' && O.RecordTypeId == '0122p000000t5g4AAA' && o.CreatedById != '0052p000009pHKVAA2'){
            feeditem sendnotification = new feeditem();
            s = o.Id;
            sendnotification.parentId = o.Id;
            sendnotification.body = 'Hello,the following Opportunity https://XXXXXXXX.lightning.force.com/lightning/r/Opportunity/'+ s + '/view is still assigned to you. Please have a look and assign it to one of your Team Members, to start Sales Process. ';
            sendnotification.Title = o.name;
            sendnotification.createdById = o.OwnerId;
            notify.add(sendnotification);
            system.debug(Notify);
          }
        }
        try{
            insert notify;
            system.debug(notify);
        }
        catch(system.DmlException e){
            system.Debug(e);
        }
}
}

Hi,
I have completed my Swagger Documentation and I want to check, if works pretty fine before giving it to the External system Developers.

Therefore, i created another partical copy sandbox for making calls to my UAT Sandbox for accessing the data.

I have created named Credential (have given url of my UAT Sandbox) in partial copy sandbox and also created an External Service for SWagger Documentation.

I would like to know the methods and complete process to integrate these two systems end to end. 


I shall be grateful to you for your kind consideration and directions.
Thanks and regards

My first system.debug is showing null value and i am not able to understand, what is wrong in it. my trigger is not working. kindly let me know. thanks :)

Trigger :

trigger SumQuote on QuoteLineItem (before delete) {
    if (trigger.isbefore && trigger.isdelete){
            SumQuoteHandler.sumQuotefeld(trigger.new);
        }
    }

Apex Class : 

public class SumQuoteHandler {
    Public static set<Id> ids;
    Public static List<Quote> QI = New List<Quote>();
    Public static List<QuoteLineItem> QLI = New List<QuoteLineItem>();
    
    Public Static void sumQuotefeld(List<QuoteLineitem>QLISUM){
        set<Id> ids = new set<Id>();
        for(QuoteLineItem QLII : QLISUM){
            Ids.add(QLII.QuoteId);
        }
        system.debug(ids);
        List<Quote> QI = [SELECT Id, Rabatt_der_einmaligen_Geb_hren__c, einmalige_Geb_hren__c, monatlicher_LP_Lizenzen__c  FROM Quote where Id IN:ids];
        system.debug(QI);
        List<QuoteLineItem> QL = [SELECT id, QuoteId FROM QuoteLineItem WHERE Id IN: Ids ];
        system.debug(QL);
        for (Quote Q : QI){
            for(QuoteLineItem QQ : QL){
                if(Q.id==QQ.QuoteId && QQ.QuoteId!=null && QQ.Produktkategorie__c=='Software Subscription'){
                          Q.Rabatt_der_einmaligen_Geb_hren__c = Q.Rabatt_der_einmaligen_Geb_hren__c-QQ.Euro_Rabatt_del__c;
                        Q.einmalige_Geb_hren__c = Q.einmalige_Geb_hren__c-QQ.GesamtpreisNEU__c;
                }
                else if(QQ.QuoteId==Q.id && QQ.QuoteId!=null && QQ.Produktkategorie__c=='Software'){
                    Q.monatlicher_LP_Lizenzen__c = Q.monatlicher_LP_Lizenzen__c-QQ.ListPrice;
                }
            }
        }
        update QI;
        system.debug(QI);
}
}


I shall be grateful to you for your valuable feedback. Thanks :)

#Sales Cloud#Batch Apex Class

I have a batch class and it throws an error for different picklist value assignment. Invalid integer whereas those fields are picklist and should be dealt as text field.
Please check the class...
Error 1 : invalid integer for 'noch k.A' & '6-25' and so on.
Error 2 : it is also not updating the field partially. no partial success.
Error 3. It's not triggering an email from Finish method. i tried then in execute method. it does not trigger there as well.

I shall be grateful to you for your kind cooperation. Thanks in advance.

global class PicklistCleaning implements Database.Batchable<sObject>, database.stateful {
    Exception[] errors = new Exception[0];
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // collect the batches of records or objects to be passed to execute
        string Query = 'select NoOfEmployees__c from Account where NoOfEmployees__c !=\'noch k. A.\' AND NoOfEmployees__c !=\'1 - 5\' AND NoOfEmployees__c !=\'6 - 25\'AND NoOfEmployees__c !=\'26 - 50\' AND NoOfEmployees__c !=\'51 - 250\' AND NoOfEmployees__c !=\'251 - 500\' AND NoOfEmployees__c !=\'501 - 1.000\' AND NoOfEmployees__c !=\'1001 - 9999\' AND NoOfEmployees__c !=\'> 10.000\'';
        system.debug(Query);
            return database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext bc, List<Account> records){
        // process each batch of records
        List<Account> Acclist = New List<Account>();
        for(Account Acc : records){
            if(acc.NoOfEmployees__c == null || acc.NoOfEmployees__c == ''){ 
                acc.NoOfEmployees__c = 'noch k. A.';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=5 || integer.valueof(acc.NoOfEmployees__c) == 1){
                acc.NoOfEmployees__c = '1 - 5';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=25 || integer.valueof(acc.NoOfEmployees__c) >= 6){
                acc.NoOfEmployees__c = '6 - 25';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=50 || integer.valueof(acc.NoOfEmployees__c) >= 26){
                acc.NoOfEmployees__c = '26 - 50';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=250 || integer.valueof(acc.NoOfEmployees__c) >= 51){
                acc.NoOfEmployees__c = '51 - 250';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=500 || integer.valueof(acc.NoOfEmployees__c) >= 251){
                acc.NoOfEmployees__c = '251 - 500';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=1000 || integer.valueof(acc.NoOfEmployees__c) >= 501){
                acc.NoOfEmployees__c = '501 - 1.000';
            }
            if(integer.valueof(acc.NoOfEmployees__c) <=9999 || integer.valueof(acc.NoOfEmployees__c) >= 1001){
                acc.NoOfEmployees__c = '1001 - 9999';
            }
            if(integer.valueof(acc.NoOfEmployees__c) >=10000){
                acc.NoOfEmployees__c = '> 10.000';
            }
            Acclist.add(acc);
        }
        try{
           Database.upsert(Acclist, false);
           Database.SaveResult[] sr = Database.update(Acclist, false);
            for(Database.SaveResult srr :  sr){
                if(srr.isSuccess()){
                    system.debug(srr.getId());
                }
                else{
                    for(Database.Error err : srr.getErrors()){
                        system.debug(err.getFields());
                        system.debug(err.message);
                        system.debug(err.getMessage());
                    }
                }
            }
        }
        catch(system.dmlexception e){
            errors.add(e);
            if(!errors.isEmpty()){
           Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
           string[] adds = new string[]{'////@test.com///'};
            mail.setSubject('Errors occurred during batch process.');
            mail.setPlainTextBody(''+errors);
            mail.setToaddresses(adds);
             List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
             mails.add(mail);
            if(mails.size() > 0){
                Messaging.sendEmail(mails);
            }
       }
        }
    }    
    global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
         if(!errors.isEmpty()){
           Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
           string[] adds = new string[]{'///////@test.com///'};
            mail.setSubject('Errors occurred during batch process.');
            mail.setPlainTextBody(''+errors);
            mail.setToaddresses(adds);
             List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
             mails.add(mail);
            if(mails.size() > 0){
                Messaging.sendEmail(mails);
            }
       }
    }    
}
Hi,
kindly have a look of button number 1 which calls button number2 and i need to pass id from button 1 to button 2.

Button 1:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
var id= '{!Account.Id}';
var ids = sforce.apex.execute('CreateContract','CreateRecord',{recId :id});
alert(ids);
function openConga(){
window.open('{!URLFOR($Action.Contract.CreatesContracts, Contract.Id)}','_blank');
}
window.open(openConga());

button 2  (name=createscontracts):
/apex/APXTConga4__Conga_Composer
?serverUrl={!API.Partner_Server_URL_370}
&id={!Contract.Id}
&TemplateId=a0M1w000001uSspEAE
&SC0=1
&SC1=Attachments
&AttachmentParentID={!Contract.Id}


while calling the button number 2, it shows the id null in conga url for (contract.Id). 
could you please assist me, how can i pass id from first javascript button to another one and can get the value for contract.id in conga url.

I shall be grateful to you for your kind assistance.
Thanks and regards
Hi,
I have a requirement where i want to call Custom button from Apex class. kindly suggest. 
I shall be grateful to you for your kind cooperation.
Thanks and regards
Hi,
i have a requirement, if first command button value 'check mapping for Attendee' is click, it should render a new button namely 'Import Attendee'. The problem is when i click first button if hundred times, it keeps the value of input file but when new rerender button got visible 'Import Attendee'. This button does not work on the same file. if i remove rerendered attributes from the 'Import Attendee' button. it works on input file as expected. but i want to show it after first button 'Check mapping for Attendee' clicked. I shall be grateful to you for your kind cooperation. Thanks in Advance.
i am getting for the rerendered attribute (attendee==true) from controller.

<apex:page standardController="ClickmeetingAttendee__c" extensions="ImportDataFromCSVController" title="Import Attendees Customers">
    <apex:form enctype="multipart/form-data">
        <apex:actionRegion>
            <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}" id="In"/>
        </apex:actionRegion>
        <apex:pageBlock id="D">
            <apex:actionRegion immediate="true" renderRegionOnly="true">
            <apex:pageBlockSection columns="4">
                  <apex:commandButton value="Check Mapping for Attendee" action="{!importCSVFileAttendee}"/>
                  <apex:commandButton value="Check Mapping for Register" action="{!importCSVFileRegister}"/>
            </apex:pageBlockSection>
            <apex:pageblockTable value="{!CMAlistattendee}" var="AttendeeHeader" id="A" rendered="{!attendee==true}"> <!---- rendered="{!attendee==true}"----->
                <apex:column value="{!AttendeeHeader.Login__c}" headerValue="Login"/>
                <apex:column value="{!AttendeeHeader.E_mail__c}" rendered="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}" headerValue="Email"/>
                <apex:column value="{!AttendeeHeader.Starts_at__c}" headerValue="Starts At"/>
                <apex:column value="{!AttendeeHeader.Ends_at__c}" headerValue="Ends At"/>
                <apex:column value="{!AttendeeHeader.Rating_comment__c}" headerValue="Rating Comment"/>
                <apex:column value="{!AttendeeHeader.Role__c}" headerValue="Role"/>
                <apex:column value="{!AttendeeHeader.Device__c}" headerValue="Device"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
            <apex:pageblockTable value="{!CMAlistsRegister}" var="AttendeeHeader" id="B" rendered="{!Register==true}">
                <apex:column value="{!AttendeeHeader.Room_ID__c}" headerValue="Room ID"/>
                <apex:column value="{!AttendeeHeader.Room_URL__c}" headerValue="Room URL"/> <!-----rendered ="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}"------>
                <apex:column value="{!AttendeeHeader.HTTP_Referer__c}" headerValue="HTTP Referer"/>
                <apex:column value="{!AttendeeHeader.Country__c}" headerValue="Country"/>
                <apex:column value="{!AttendeeHeader.City__c}" headerValue="City"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Registration_Date__c}" headerValue="Registration Date"/>
                <apex:column value="{!AttendeeHeader.Login_Url__c}" headerValue="Login URL"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
                <apex:pageBlockSection>
                <apex:commandButton value="Import Attendee" action="{!importCSVFile}" rendered="{!attendee==true}"/> <!---rendered="{!Attendee==true}"---->
                </apex:pageBlockSection>
            <apex:pageBlockSection>
                <apex:commandButton value="Import Registered User" action="{!importCSVFiles}" rendered="{!register==true}"/><!------ rendered="{!register==true}"----->
            </apex:pageBlockSection>
            <apex:image rendered="{!flag==true}" value="{!URLFOR($Resource.WellDone)}"/>
            <apex:image rendered="{!flags==true}" value="{!URLFOR($Resource.Excitedkid)}"/>
            <apex:pageMessages />
            </apex:actionRegion>
        </apex:pageBlock>
   </apex:form>
</apex:page>



Thanks :)
My first system.debug is showing null value and i am not able to understand, what is wrong in it. my trigger is not working. kindly let me know. thanks :)

Trigger :

trigger SumQuote on QuoteLineItem (before delete) {
    if (trigger.isbefore && trigger.isdelete){
            SumQuoteHandler.sumQuotefeld(trigger.new);
        }
    }

Apex Class : 

public class SumQuoteHandler {
    Public static set<Id> ids;
    Public static List<Quote> QI = New List<Quote>();
    Public static List<QuoteLineItem> QLI = New List<QuoteLineItem>();
    
    Public Static void sumQuotefeld(List<QuoteLineitem>QLISUM){
        set<Id> ids = new set<Id>();
        for(QuoteLineItem QLII : QLISUM){
            Ids.add(QLII.QuoteId);
        }
        system.debug(ids);
        List<Quote> QI = [SELECT Id, Rabatt_der_einmaligen_Geb_hren__c, einmalige_Geb_hren__c, monatlicher_LP_Lizenzen__c  FROM Quote where Id IN:ids];
        system.debug(QI);
        List<QuoteLineItem> QL = [SELECT id, QuoteId FROM QuoteLineItem WHERE Id IN: Ids ];
        system.debug(QL);
        for (Quote Q : QI){
            for(QuoteLineItem QQ : QL){
                if(Q.id==QQ.QuoteId && QQ.QuoteId!=null && QQ.Produktkategorie__c=='Software Subscription'){
                          Q.Rabatt_der_einmaligen_Geb_hren__c = Q.Rabatt_der_einmaligen_Geb_hren__c-QQ.Euro_Rabatt_del__c;
                        Q.einmalige_Geb_hren__c = Q.einmalige_Geb_hren__c-QQ.GesamtpreisNEU__c;
                }
                else if(QQ.QuoteId==Q.id && QQ.QuoteId!=null && QQ.Produktkategorie__c=='Software'){
                    Q.monatlicher_LP_Lizenzen__c = Q.monatlicher_LP_Lizenzen__c-QQ.ListPrice;
                }
            }
        }
        update QI;
        system.debug(QI);
}
}


I shall be grateful to you for your valuable feedback. Thanks :)