• Bhanu Partap
  • NEWBIE
  • 85 Points
  • Member since 2015

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 17
    Replies
if(lo.lat__c == null || lo.long__c == null || (lo.Zip_Code__c != null && Trigger.oldMap.get(lo.id).Zip_Code__c != lo.Zip_Code__c)) getting this error in this statement can one help out urgent
I have created a tool which allows me to upload a CSV, it will then upload what it can and then those that it cant (if they fall under two criteria), will be added to an errorlist, which will be downloaded. It works pretty well except for a few things: It seems to have a random limit on the ampunt of records I can upload at a time. Sometimes its 4 sometimes 5....but, it is designed to allow tens at a time. This is the email exception i get when it fails:
caused by: System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking.


It also seems to be randomly changing one field in another object call AccountStatus.

Please, anyone with knowledge of Apex, please look at my code and give me any tips that they can. Thank you in advance for your help

 
public class FileUploader_TraEziDebit
{

    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    public List<Transaction__c> EziDebitUpload;
    public List<Transaction__c> EziDebitError;
    
    public ID DocId {get; set;}

    //Introduce string which will link the transactions to the correct Account
    Set<String> AccLinks = new Set<String>();
    Set<String> SerLinks = new Set<String>();
     List<Account> existAccounts = new List<Account>();
     List<Service__c> existServices = new List<Service__c>();
     List<String> EziDebitList = new List<String>();
    
    Map<String, ID> AccMap = new Map<String, ID>(); // Define a new Account map
    Map<String, ID> OffMap = new Map<String, ID>(); // Define a new Office map
    Map<String, ID> SerMap = new Map<String, ID>(); // Define a new Service map
    
    Datetime mydate = System.Now();
    String S = mydate.format('dd/MM/yyyy');
    String EziDebitId;
    String TransactionError; //Error Message
    Integer UploadCount;
    Integer ErrorCount;

    
       
    public FileUploader_TraEziDebit(Transaction_Query controller){
    filelines  = new String[]{};
     EziDebitUpload = New List<Transaction__c>();
     EziDebitError = New List<Transaction__c>();
     UploadCount = 0;
     ErrorCount = 0;
   }
    
    public Pagereference ReadFile()
    {
    List<Account> existAccounts = [SELECT Id, Office__c, Ezidebit_Payer_ID__c  FROM Account where Ezidebit_Payer_ID__c != null];
    if(existAccounts != null && existAccounts.size() > 0 ){
    for(Account Acc : existAccounts){
        AccLinks.add(Acc.Ezidebit_Payer_ID__c);
        AccMap.put(Acc.Ezidebit_Payer_ID__c, Acc.Id);
        OffMap.put(Acc.Ezidebit_Payer_ID__c, Acc.Office__c);
                                                }
                                                                }
     List<Service__c> existServices = [SELECT Id, Payment_Choice__c, UpperCaseId__c , Amount_remaining__c FROM Service__c];
     if(existServices != null && existServices.size() > 0 ){
     for(Service__c Ser : existServices){
          String SerID = ser.id;
         // String SerID15 = SerID.substring(0, 15); //Changed from substring of 15
          SerLinks.add(SerID);
          SerMap.put(Ser.UpperCaseId__c,SerID);
                                                }
                                                                }
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        EziDebitUpload = new List<Transaction__c>();
        
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            
        String SerRef = string.valueof(inputvalues[2]);
        String SerMatch = SerRef.substring(0, 18); 
        String SerKey = SerMap.get(SerMatch);
            
        if( AccLinks.contains(inputvalues[1]) && SerLinks.contains(SerKey) ){
        
               Transaction__c Tra = new Transaction__c() ; 
               Tra.date_of_payment__c = date.parse(inputvalues[0]); 
               EziDebitId = inputvalues[1];
               Tra.Ezidebit_Payer_ID__c = inputvalues[1];
               Tra.Account__c = AccMap.get(EziDebitId);
               Tra.Office__c = OffMap.get(EziDebitId);
               Tra.Destiny_Service_No__c = SerKey;
               Tra.Amount__c = decimal.valueof(inputvalues[3]);
               Tra.Method__c = 'EZIDEBIT';
               Tra.Transaction_Type__c = 'Part Payment';                                                                              
               EziDebitUpload.add(Tra);
               UploadCount = UploadCount+1;   
            
                 }else{
                 
                 //Creating error records
                 //! at the front will negate the statement
             
               Transaction__c Tra = new Transaction__c(); 
               TransactionError = 'Error: ';
               Tra.date_of_payment__c = date.parse(inputvalues[0]); 
               EziDebitId = inputvalues[1];
               Tra.Ezidebit_Payer_ID__c = inputvalues[1];
               if(AccLinks.contains(inputvalues[1])){
               TransactionError = TransactionError+'EziDebit Player ID was found, ';
               }else if(!AccLinks.contains(inputvalues[1])){
               TransactionError = TransactionError+'EziDebit Player ID not found on Account, ';
               }
               if(SerLinks.contains(SerKey)){
               TransactionError = TransactionError+'Service ID was found in the org.';
               }else if(!SerLinks.contains(SerKey)){
               TransactionError = TransactionError+'Service ID not found.';
               }
               Tra.Account__c = AccMap.get(EziDebitId);
               Tra.Office__c = OffMap.get(EziDebitId);
               Tra.Destiny_Service_No__c = SerMap.get(SerMatch);
               Tra.Amount__c = decimal.valueof(inputvalues[3]);
               Tra.Method__c = 'EZIDEBIT';
               Tra.Transaction_Type__c = 'Part Payment';
               tra.EziDebit_Error__c = TransactionError;                                                                            
               EziDebitError.add(Tra);
               
               ErrorCount = ErrorCount+1;  
                
                 }
                        }
                
               string header =  'Transaction Date,Ezidebit Payer ID,Client Contract Ref,  Schedule Collected  ,  Actual Collected  ,  Transaction Fee  ,  Credit Card Fee  ,Transaction_Type, Error Message\n';
                string finalstr = header ; //Error CSV Header
                if(EziDebitError != null && EziDebitError.size() > 0 ){
                for(Transaction__c tran: EziDebitError)
                    {
               string recordString = '"'+Tran.date_of_payment__c+'","'+Tran.Ezidebit_Payer_ID__c+'","'+Tran.Destiny_Service_No__c+'","'+Tran.Amount__c+'","'+''+'","'+''+'","'+''+'","'+Tran.Transaction_Type__c+'","'+Tran.EziDebit_Error__c+'"\n';
               finalstr = finalstr +recordString;
                        }

            Blob csvBlob = Blob.valueof(finalstr);
            Document tDoc = new Document();
            tDoc.Name = 'Error_EziDebit #'+S;
            tDoc.Type = 'csv';
            tDoc.body = csvBlob;
            tDoc.FolderId = '00l90000001aggJ';  /* -00lN0000000M9Pm-  id of whatever Salesforce document folder you want to use*/
                   
           insert tDoc;
           DocId = tDoc.id;  /*after this, you can use the ID from your newly inserted document as a URL parameter for the download link*/
           
           ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'There is an error with '+ErrorCount+' of the EziDebit Payer Ids, please click the link to download the errors');
           ApexPages.addMessage(errormsg);
           }

        try{
    
         if(EziDebitUpload != null && EziDebitUpload.size() > 0 ){
        insert EziDebitUpload;

        
        
        ApexPages.Message Successmsg = new ApexPages.Message(ApexPages.severity.confirm, UploadCount+' EziDebit Transactions have been uploaded');
        ApexPages.addMessage(Successmsg);
                                    }
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
         return null;                          
        
         
    }   
    
    
}


 
Hi!
I wrote Apex class:

@RestResource(urlMapping='/show/*')
global with sharing class User{
@HttpGet global static string doGet(){
    Map < String, String > FieldMetaData = new Map< String, String >();
    FieldMetaData.put('type', 'string');
    FieldMetaData.put('label', 'label name');
    FieldMetaData.put('name', 'first name');
    FieldMetaData.put('length', '20');
    String FieldMetaDataResult = JSON.serialize(FieldMetaData);
    return FieldMetaDataResult ;
}
}

when I call it from php script the result is:
"{\"type\":\"string\",\"label\":\"label name\",\"length\":\"20\",\"name\":\"first name\"}"
How can I return result without slashes and double quotes? I need a normal json, namely:
{"type":"string","label":"label name","length":"20","name":"first name"}
Thank you!
if(lo.lat__c == null || lo.long__c == null || (lo.Zip_Code__c != null && Trigger.oldMap.get(lo.id).Zip_Code__c != lo.Zip_Code__c)) getting this error in this statement can one help out urgent
Hi,

On the Quote Line Item there is a custom button called - Add New Product. This custom button is linked to a VF page called CustomProductAdd.

When user clicks on this custom button he is presented a page where he enters - Product Name and Product Description. 
Next he clicks on Add New Product.

Then another section is displayed on the same page ( custom product add) asking for more details about the product. The product added on this custom page is suppose to be added to PRODUCT2 table. 

The product gets added to the table but somehow the page is not refreshed and goes into an infite loop and throws these errors :-
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Delete failed. First exception on row 0 with id 0QL50000000WHS4GAO; first error: ENTITY_IS_DELETED, entity is deleted: []
Error is in expression '{!leavePage}' in page customproductadd: Class.AddPartController.leavePage: line 260, column 1
An unexpected error has occurred. Your development organization has been notified.
/////////////////////////////////////////////////////////////////////////////////

In the AddPartController the Leavepage displays following code :-

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

public void leavePage(){

        for(quoteLineItem qli2 :QuoteNewLineItemList){
            system.debug('TO BE DELETED =' + qli2.ID); 
        }
        List<QuoteLineItem> delQli = new List<QuoteLineItem>();
        if(QuoteNewLineItemList != null && QuoteNewLineItemList.size() != 0 && QuoteNewLineItemList.isempty() == false){
            for(QuoteLineItem qlid : QuoteNewLineItemList){
                if(qlid.IsDeleted != true){
                    delQli.add(qlid);
                }
            }
            delete delQli;
        } 
    }

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

the above function is being called out in the VF Page like this :-


<apex:actionfunction name="runExit" action="{!leavePage}" />


Can you suggest the reason for this error? A different developer did this coding for us and some thing seems to be broken now.

thanks.
//////////////////////////////////////////////////////////////////////////////////////////
I have created a tool which allows me to upload a CSV, it will then upload what it can and then those that it cant (if they fall under two criteria), will be added to an errorlist, which will be downloaded. It works pretty well except for a few things: It seems to have a random limit on the ampunt of records I can upload at a time. Sometimes its 4 sometimes 5....but, it is designed to allow tens at a time. This is the email exception i get when it fails:
caused by: System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking.


It also seems to be randomly changing one field in another object call AccountStatus.

Please, anyone with knowledge of Apex, please look at my code and give me any tips that they can. Thank you in advance for your help

 
public class FileUploader_TraEziDebit
{

    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    public List<Transaction__c> EziDebitUpload;
    public List<Transaction__c> EziDebitError;
    
    public ID DocId {get; set;}

    //Introduce string which will link the transactions to the correct Account
    Set<String> AccLinks = new Set<String>();
    Set<String> SerLinks = new Set<String>();
     List<Account> existAccounts = new List<Account>();
     List<Service__c> existServices = new List<Service__c>();
     List<String> EziDebitList = new List<String>();
    
    Map<String, ID> AccMap = new Map<String, ID>(); // Define a new Account map
    Map<String, ID> OffMap = new Map<String, ID>(); // Define a new Office map
    Map<String, ID> SerMap = new Map<String, ID>(); // Define a new Service map
    
    Datetime mydate = System.Now();
    String S = mydate.format('dd/MM/yyyy');
    String EziDebitId;
    String TransactionError; //Error Message
    Integer UploadCount;
    Integer ErrorCount;

    
       
    public FileUploader_TraEziDebit(Transaction_Query controller){
    filelines  = new String[]{};
     EziDebitUpload = New List<Transaction__c>();
     EziDebitError = New List<Transaction__c>();
     UploadCount = 0;
     ErrorCount = 0;
   }
    
    public Pagereference ReadFile()
    {
    List<Account> existAccounts = [SELECT Id, Office__c, Ezidebit_Payer_ID__c  FROM Account where Ezidebit_Payer_ID__c != null];
    if(existAccounts != null && existAccounts.size() > 0 ){
    for(Account Acc : existAccounts){
        AccLinks.add(Acc.Ezidebit_Payer_ID__c);
        AccMap.put(Acc.Ezidebit_Payer_ID__c, Acc.Id);
        OffMap.put(Acc.Ezidebit_Payer_ID__c, Acc.Office__c);
                                                }
                                                                }
     List<Service__c> existServices = [SELECT Id, Payment_Choice__c, UpperCaseId__c , Amount_remaining__c FROM Service__c];
     if(existServices != null && existServices.size() > 0 ){
     for(Service__c Ser : existServices){
          String SerID = ser.id;
         // String SerID15 = SerID.substring(0, 15); //Changed from substring of 15
          SerLinks.add(SerID);
          SerMap.put(Ser.UpperCaseId__c,SerID);
                                                }
                                                                }
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        EziDebitUpload = new List<Transaction__c>();
        
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            
        String SerRef = string.valueof(inputvalues[2]);
        String SerMatch = SerRef.substring(0, 18); 
        String SerKey = SerMap.get(SerMatch);
            
        if( AccLinks.contains(inputvalues[1]) && SerLinks.contains(SerKey) ){
        
               Transaction__c Tra = new Transaction__c() ; 
               Tra.date_of_payment__c = date.parse(inputvalues[0]); 
               EziDebitId = inputvalues[1];
               Tra.Ezidebit_Payer_ID__c = inputvalues[1];
               Tra.Account__c = AccMap.get(EziDebitId);
               Tra.Office__c = OffMap.get(EziDebitId);
               Tra.Destiny_Service_No__c = SerKey;
               Tra.Amount__c = decimal.valueof(inputvalues[3]);
               Tra.Method__c = 'EZIDEBIT';
               Tra.Transaction_Type__c = 'Part Payment';                                                                              
               EziDebitUpload.add(Tra);
               UploadCount = UploadCount+1;   
            
                 }else{
                 
                 //Creating error records
                 //! at the front will negate the statement
             
               Transaction__c Tra = new Transaction__c(); 
               TransactionError = 'Error: ';
               Tra.date_of_payment__c = date.parse(inputvalues[0]); 
               EziDebitId = inputvalues[1];
               Tra.Ezidebit_Payer_ID__c = inputvalues[1];
               if(AccLinks.contains(inputvalues[1])){
               TransactionError = TransactionError+'EziDebit Player ID was found, ';
               }else if(!AccLinks.contains(inputvalues[1])){
               TransactionError = TransactionError+'EziDebit Player ID not found on Account, ';
               }
               if(SerLinks.contains(SerKey)){
               TransactionError = TransactionError+'Service ID was found in the org.';
               }else if(!SerLinks.contains(SerKey)){
               TransactionError = TransactionError+'Service ID not found.';
               }
               Tra.Account__c = AccMap.get(EziDebitId);
               Tra.Office__c = OffMap.get(EziDebitId);
               Tra.Destiny_Service_No__c = SerMap.get(SerMatch);
               Tra.Amount__c = decimal.valueof(inputvalues[3]);
               Tra.Method__c = 'EZIDEBIT';
               Tra.Transaction_Type__c = 'Part Payment';
               tra.EziDebit_Error__c = TransactionError;                                                                            
               EziDebitError.add(Tra);
               
               ErrorCount = ErrorCount+1;  
                
                 }
                        }
                
               string header =  'Transaction Date,Ezidebit Payer ID,Client Contract Ref,  Schedule Collected  ,  Actual Collected  ,  Transaction Fee  ,  Credit Card Fee  ,Transaction_Type, Error Message\n';
                string finalstr = header ; //Error CSV Header
                if(EziDebitError != null && EziDebitError.size() > 0 ){
                for(Transaction__c tran: EziDebitError)
                    {
               string recordString = '"'+Tran.date_of_payment__c+'","'+Tran.Ezidebit_Payer_ID__c+'","'+Tran.Destiny_Service_No__c+'","'+Tran.Amount__c+'","'+''+'","'+''+'","'+''+'","'+Tran.Transaction_Type__c+'","'+Tran.EziDebit_Error__c+'"\n';
               finalstr = finalstr +recordString;
                        }

            Blob csvBlob = Blob.valueof(finalstr);
            Document tDoc = new Document();
            tDoc.Name = 'Error_EziDebit #'+S;
            tDoc.Type = 'csv';
            tDoc.body = csvBlob;
            tDoc.FolderId = '00l90000001aggJ';  /* -00lN0000000M9Pm-  id of whatever Salesforce document folder you want to use*/
                   
           insert tDoc;
           DocId = tDoc.id;  /*after this, you can use the ID from your newly inserted document as a URL parameter for the download link*/
           
           ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'There is an error with '+ErrorCount+' of the EziDebit Payer Ids, please click the link to download the errors');
           ApexPages.addMessage(errormsg);
           }

        try{
    
         if(EziDebitUpload != null && EziDebitUpload.size() > 0 ){
        insert EziDebitUpload;

        
        
        ApexPages.Message Successmsg = new ApexPages.Message(ApexPages.severity.confirm, UploadCount+' EziDebit Transactions have been uploaded');
        ApexPages.addMessage(Successmsg);
                                    }
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
         return null;                          
        
         
    }   
    
    
}


 
I am working on writing apex sharing anonymous code,
for(Account abc: [select Owner, CreatedBy, LastModifiedBy from account where CALENDAR_YEAR(createddate) = 2014]

How to assign UserOrGroupId with Owner, CreatedBy, LastModifiedBy for one account record. Pls suggest.
Hi,
I have similar endpoint in my wsdl apex generated code, I want to generic it among all environment, pls suggest. Any pseodo code is nice to have.

public String endpoint_x = 'http://YourServer/YourService';

Thanks,
Abhi
Hi!
I wrote Apex class:

@RestResource(urlMapping='/show/*')
global with sharing class User{
@HttpGet global static string doGet(){
    Map < String, String > FieldMetaData = new Map< String, String >();
    FieldMetaData.put('type', 'string');
    FieldMetaData.put('label', 'label name');
    FieldMetaData.put('name', 'first name');
    FieldMetaData.put('length', '20');
    String FieldMetaDataResult = JSON.serialize(FieldMetaData);
    return FieldMetaDataResult ;
}
}

when I call it from php script the result is:
"{\"type\":\"string\",\"label\":\"label name\",\"length\":\"20\",\"name\":\"first name\"}"
How can I return result without slashes and double quotes? I need a normal json, namely:
{"type":"string","label":"label name","length":"20","name":"first name"}
Thank you!
We have a class that handles lead inserts from a 3rd party source. Within the class, we have created an inner class called LeadDetailResponseData which handles the lead insert responses.

global class LeadDetailResponseData {
    public Integer MessageId;
    public String Status;
    public String ErrorMessage;
  }

We have then created a list of 'LeadDetailResponseData' types that will store the results of the lead import:

List<LeadDetailResponseData> ResponseMsg = new List<LeadDetailResponseData>();

Upon insertion, if there are any errors, it is getting stored to the ErrorMessage variable. The message then gets added to the list of Lead Detail Responses. Note that l is an instance of a Lead object and lr is an instance of the LeadResponseDetail class.

   try {
            l.setOptions(dmo);
            insert l;
          } catch (DmlException e) {
            lr.Status = '-1'; //Insert Error
            lr.ErrorMessage = e.getMessage();
          }  

   ResponseMsg.Add(lr);
   return ResponseMsg;

My question is where does the Return go? Is it returned to the process that's calling this class? Or is it stored somewhere within the instance of Salesforce.

Any feedback is much appreciated.

Thanks.
Hi everyone
For Lead object i want to put a Visualforce page as a section in it. However, the height of the content varies, and when I drop the section in, there is a large white space if the content does not fill. How do I deal with this.

Can anyone help me out to solve this issue.....

User-added image
Thank you in advance...
I created three custom formula fields on the QuoteLineItem table.

I am trying to add Roll Up fields on the Quote to sum these three variables.

One of the three variables is available to Roll Up, but the other 2 are not.  I did some research in this forum and found postings that said a formula filed cannot be used in another Roll Up field.  This made some sense until I was able to do it once.

Any possible ideas why one formula field would be available for a Roll Up Summary but other formula fields are not?  I should mention that none of the 3 fields I created on the Quote Line Items table are Roll Up Summary fields.  They are simple add and subtract math type fields.

Any help would be appreciated.
Hi Everyone,

While writting test class webservice callouts, i'm getting the following Exception.
you have uncommitted work pending. Please commit or rollback before calling out.

my test class:
----------------------
@isTest
public class GSD_partordercontroller_TESTROH {
    
    private static void createCustomSetting(){
            HPTriggerFrameworkObjectMapping__c CSPOobj=new HPTriggerFrameworkObjectMapping__c(Name='GSD_Part_Order__c ', DispatcherCalssName__c='GSDPartOrder');
            insert CSPOobj;
            HPTriggerFrameworkObjectMapping__c CSPOLobj=new HPTriggerFrameworkObjectMapping__c(Name='GSD_Part_Order_Line__c', DispatcherCalssName__c='GSDPartOrderLine');
            insert CSPOLobj;
            HPTriggerFrameworkObjectMapping__c trigFramework = new HPTriggerFrameworkObjectMapping__c(name = 'CKSW__Task__c',DispatcherCalssName__c = 'GSDTask');
            insert trigFramework;
            HPTriggerFrameworkObjectMapping__c resourceCS = new HPTriggerFrameworkObjectMapping__c(name = 'CKSW__Engineer_Equipment__c',DispatcherCalssName__c = 'GSDResource');
            insert resourceCS;
            HPTriggerFrameworkObjectMapping__c GsdCaseQuote=new HPTriggerFrameworkObjectMapping__c(name='GSD_Case_Quote__c',DispatcherCalssName__c='GSDCaseQuote');
            insert GsdCaseQuote;
             HPTriggerFrameworkObjectMapping__c partPickLoCObj=new HPTriggerFrameworkObjectMapping__c(name='GSD_Part_Pickup_Location__c',DispatcherCalssName__c='GSDPartPickupLocation');
            insert partPickLoCObj;

        } 
Private testmethod static void MethodFROH(){
        createCustomSetting();
   // Test.setMock(WebServiceMock.class, new GSDTrunkPartOrderWebMockIml());
    test.startTest();
    CKSW__Engineer_Equipment__c resourecObj =  new CKSW__Engineer_Equipment__c( Name='Test resource',Standby_Dispatch_Policy__c='Bulk',
                                                                                    Mobile__c='9663066004', CKSW__User__c=userinfo.getUserId());
        insert resourecObj;
        
        GSD_Business_Center__c buscenter= new GSD_Business_Center__c(Name='Test Business' ,Business_Center_Key__c=123456,Active__c=true);
        insert buscenter;
        
        Account newAccount= new Account(Name='Test Account');
        insert newAccount;
        contact newContact =new contact(FirstName='Joe',LastName='Smith',Phone='415.555.1212',AccountId=newAccount.Id);
        Asset AsetObj=new Asset();
        AsetObj.name='as1';
        AsetObj.HP_Product_Number__c='H4U87ES';
        AsetObj.HP_Asset_Type__c='PPS GSB Asset';
        AsetObj.Manufacturer__c='HP DesignJet (PL30)';
        AsetObj.Status='Active';
        AsetObj.HP_Product_Model__c='30 - DesignJet HW';
        AsetObj.AccountId=newAccount.Id;
        insert AsetObj;
        BusinessHours newBusHours= new BusinessHours(Name='Default');
        Case newCase= new Case(status='open', BusinessHours=newBusHours,source_system_case_id__c='98000057131', 
                               Severity__c='3-NORMAL', Description='Test Description', OwnerId=userinfo.getUserId(),Reason='ABP Support',NBD_SBD__c='NBD');
        newCase.Requestor_s_TimeZone__c='(GMT+00:00) British Standard Time (Europe/London)';
        newCase.AssetId=AsetObj.Id;
        newcase.Last_Service_Delivery_Time__c=system.now()+1;
        newCase.Entitlement_SLA_Response__c='RESPONSE_TIME';
        newCase.Latest_Service_DateTime__c=system.now();
        newCase.Mission_Critical__c=true;
        newCase.OrderTypeCode__c='00E-No Entitlement';
        insert newCase;
        GSD_Part_Order__c POObj=new GSD_Part_Order__c(name='Po',Legacy_Part_Order_number__c='1234567891-123-1');
        POObj.ISO2_Character_Country_Code__c='AX'; 
        POObj.Country__c='AF';
        POObj.Order_Reason_Code__c='615-Customer Self Repair (CSR)';
        POObj.Shipping_Condition_Code__c='SBD';
        POObj.Shipping_Carrier_Code__c='S3-DHL';
        POObj.Case_Number__c=newcase.id;
        POObj.Part_Delivery_Requested_TimeStamp__c=system.now();
        POObj.Part_Order_Type_Code__c='ZSSB Exchange Order';
        POObj.Delivery_Priority_Code__c='40-Manual Escalations';
        POObj.Special_Delivery_Process_Code__c='21-Next Flight Out';
        insert POObj;
        GSD_Part_Order_Line__c partorderline=new GSD_Part_Order_Line__c(name='pol',Part_Order_Header_Number__c=POObj.Id);
         partorderline.Logistics_Estimated_Arrival_TimeStamp__c=system.now()+1;
         partorderline.Part_Response_Status_Code__c='BACKORDER';
         partorderline.Offered_Part_Identifier__c='abcOfr';
         partorderline.Part_Identifier__c='Test';
         partorderline.Part_Line_Status__c='Cancelled';
         partorderline.Part_Description__c='Description';
        insert partorderline;
        World_Region__c WR=new World_Region__c();
        wr.Name='AX';
        insert WR;
        World_Region_Configuration__c WRCObj=new World_Region_Configuration__c();
        WRCObj.Text_Value__c='test';
        WRCObj.World_Region__c=WR.Id;
        WRCObj.Name='GSD_iGSO_Sales_Organization';
        insert WRCObj;
        GSD_ODM_Reference__c ODMObj=new GSD_ODM_Reference__c();
        ODMObj.name='odm123';
        insert ODMObj;
        list<gsd_offer__C> LIObj=new list<gsd_offer__C>();
        gsd_offer__C OFFObj=new gsd_offer__C();
        OFFObj.name='off1';
        OFFObj.Case__c=newCase.Id;
        OFFObj.Offer_Reference__c=ODMObj.Id;
        OFFObj.Start_Date__c=system.today();
        OFFObj.End_Date__c=system.today()+1; 
        OFFObj.Entitlement_Type_Code__c='W';
        insert OFFObj;
        LIObj.add(OFFObj);
        GSD_Integration_Data__c trunkpartorder=new GSD_Integration_Data__c();
        trunkpartorder.End_point_URL__c='https://it-services-gw-csc-stg.itcs.hp.com/gw/hpit/egit/createtrunkpartorder.itg';
        trunkpartorder.Name='Trunkpartorder';
        trunkpartorder.Time_out__c=120000;
        trunkpartorder.Client_Certificate__c='';
        insert trunkpartorder; 
        
        Apexpages.StandardController sc = new Apexpages.standardController(POObj);
        GSD_PartOrderController POCObj=new GSD_PartOrderController(sc);
        POCObj.closeValidateAddressPopUp();
        POCObj.caseobj=newcase;
        POCObj.orderobj=POObj;
        POCObj.orderid='';
        POCObj.partorderid=POObj.id;
        //MonitorUtility objmonitorutility=new MonitorUtility();
        POCObj.Transactionid='TrunkPartOrder';
        GSDCustomerTimeZoneUtility LTZObj=new GSDCustomerTimeZoneUtility();
        string tZ='(GMT+09:00) Japan Standard Time (Asia/Tokyo)';
        GSDCustomerTimeZoneUtility.LongNameToTimeZone(tZ);
        
     
   // GsdTrunkpartorderCreateResponse.CreateTrunkPartOrderEndpoint3 resObj=new GsdTrunkpartorderCreateResponse.CreateTrunkPartOrderEndpoint3();
    test.stopTest();
    Test.setMock(WebServiceMock.class, new GSDTrunkPartOrderWebMockIml());  
    
    POCObj.TrunkPartorder();
    
    }
       private testmethod static void methodFEntitleElseblcok(){
        
        createCustomSetting();
        CKSW__Engineer_Equipment__c resourecObj =  new CKSW__Engineer_Equipment__c( Name='Test resource',Standby_Dispatch_Policy__c='Bulk',
                                                                                    Mobile__c='9663066004', CKSW__User__c=userinfo.getUserId());
        insert resourecObj;
        
        GSD_Business_Center__c buscenter= new GSD_Business_Center__c(Name='Test Business' ,Business_Center_Key__c=123456,Active__c=true);
        insert buscenter;
        
        Account newAccount= new Account(Name='Test Account');
        insert newAccount;
        contact newContact =new contact(FirstName='Joe',LastName='Smith',Phone='415.555.1212',AccountId=newAccount.Id);
        Asset AsetObj=new Asset();
        AsetObj.name='as1';
        AsetObj.HP_Product_Number__c='H4U87ES';
        AsetObj.HP_Asset_Type__c='PPS GSB Asset';
        AsetObj.Manufacturer__c='HP DesignJet (PL30)';
        AsetObj.Status='Active';
        AsetObj.HP_Product_Model__c='30 - DesignJet HW';
        AsetObj.AccountId=newAccount.Id;
        insert AsetObj;
        BusinessHours newBusHours= new BusinessHours(Name='Default');
        Case newCase= new Case(status='open', BusinessHours=newBusHours,source_system_case_id__c='98000057131', 
                               Severity__c='3-NORMAL', Description='Test Description', OwnerId=userinfo.getUserId(),Reason='ABP Support',NBD_SBD__c='SBD');
        newCase.Mission_Critical__c=true;
        newCase.AssetId=AsetObj.Id;
        newcase.Last_Service_Delivery_Time__c=system.now()+1;
        insert newCase;
       // ApexPages.currentPage().getParameters().put('caseid', newCase.Id);
        GSD_Case_Quote__c quote = new GSD_Case_Quote__c(name = 'Test Quote', Case__c = newCase.id);
        insert quote;
        
        CKSW__TaskType__c taskType= new CKSW__TaskType__c(Name='Repair', CKSW__Duration__c=20);
        insert taskType;
        CKSW__WorkOrder__c workOrder= new CKSW__WorkOrder__c(CKSW__Account__c=newAccount.Id,
                                      CKSW__StartDate__c=Date.Today(), CKSW__EndDate__c=Date.Today());
        insert workOrder;
        CKSW__Task__c taskRec = new CKSW__Task__c(CKSW__WorkOrder__c=workOrder.Id, CKSW__TaskType__c=taskType.Id,Business_Center__c=buscenter.Id,
                                                  External_Task_Identifier__c='98000057131-971', CKSW__Assigned_Resource__c=resourecObj.Id,Product_Number__c='123',Serial_Number__c='S123',Case_Quote__c=quote.id);
        taskRec.Entitled_Service_Window_Start_DateTime__c=system.now();
        taskRec.Requested_Service_Window_Start_DateTime__c=system.now();
        taskRec.Entitled_Service_Window_End_DateTime__c=system.now();
        taskRec.Requested_Service_Window_End_DateTime__c=system.now();
        taskRec.CKSW__Country__c='India';
        taskRec.CKSW__Street__c='biji';
        taskREc.CKSW__City__c='Bangalore';
        taskRec.CKSW__State__c='Karnataka';
        taskREc.CKSW__Zip_Postal_Code__c='560100';
        insert taskRec ;
       
        GSD_ODM_Reference__c ODMObj=new GSD_ODM_Reference__c();
        ODMObj.name='odm123';
        insert ODMObj;
        
        ApexPages.currentPage().getParameters().put('caseid', newCase.Id);
        GSD_Part_Order__c POObj=new GSD_Part_Order__c(Case_Number__c=newCase.id,Service_Delivery_Type__c='Onsite');
        POObj.Legacy_Part_Order_number__c='1234567890-123-1';
        POObj.Pending_Transaction_Type__c='Trans';
        POObj.ISO2_Character_Country_Code__c='AX';
        POObj.Shipping_Carrier_Code__c='S1-Postal Service';
        POObj.Shipping_Condition_Code__c='None';
        POObj.Service_Delivery_Type__c='CSR';
        POObj.Delivery_Priority_Code__c='None';
        POObj.Street2__c='street2';
        POObj.Company_Name__c='company1';
        POObj.Responsible_Party_Id__c='RPID';
        POObj.Order_Status_Code__c='Recommended';
        insert POObj;
        World_Region__c WR=new World_Region__c();
        wr.Name='AX';
       // Wr.ParentId__c=POObj.ISO2_Character_Country_Code__c;
       
        insert WR;
        list<World_Region_Configuration__c> lstwrc=new list<World_Region_Configuration__c>();
        World_Region_Configuration__c wrObj=new World_Region_Configuration__c();
           
        wrObj.World_Region__c=wr.Id;
        wrObj.Name='GSD_iGSO_Sales_Organization';
        insert wrObj;
        lstwrc.add(wrobj);
        
        GSD_Part_Order_Line__c partorderline=new GSD_Part_Order_Line__c(name='pol',Part_Order_Header_Number__c=POObj.Id);
        partorderline.Part_Line_Status__c='On Hold';
        partorderline.Part_Identifier__c='PI';
        insert partorderline;
        List<GSD_Part_Order_Line__c> WLPOLObj=new List<GSD_Part_Order_Line__c>();
        WLPOLObj.add(partorderline); 
        
        list<gsd_offer__C> LIObj=new list<gsd_offer__C>();
        gsd_offer__C OFFObj=new gsd_offer__C();
        OFFObj.name='off1';
        OFFObj.Case__c=newCase.Id;
        OFFObj.Offer_Reference__c=ODMObj.Id;
        OFFObj.Start_Date__c=system.today();
        OFFObj.End_Date__c=system.today()+1;        
        insert OFFObj;
        LIObj.add(OFFObj);
        
        Apexpages.StandardController sc = new Apexpages.standardController(POObj);
        GSD_PartOrderController POCObj=new GSD_PartOrderController(sc);
        GSD_PartOrderController.postback=true;
        POCObj.CaseId=newCase.id;
        POCObj.TaskId=taskRec.Id;
        POCObj.partorderid=POObj.id;
        POCObj.taskObj=taskRec;
        
        boolean isChecked=true;
        boolean isSLAmet=true;
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('US','US'));
        String PromisedTimeCOnvertedtoCTZ='re';
        GSD_PartOrderController.partOrderLineWrapper POLObj=new GSD_PartOrderController.partOrderLineWrapper(isChecked,isSLAmet,partorderline,options,PromisedTimeCOnvertedtoCTZ);
        list<GSD_PartOrderController.partOrderLineWrapper> WPOLObj=new list<GSD_PartOrderController.partOrderLineWrapper>();
        WPOLObj.add(POLObj);
        POCObj.wl= WPOLObj;
        POCObj.onPageLoad();
        POCObj.closeValidateAddressPopUp();
        POCObj.FillEntitlementsection();
        

        GsdAtpStream ATPObj=new GsdAtpStream();
        GsdAtpStream.GetATPType GetAtp=new GsdAtpStream.GetATPType();
        GsdAtpStream.AddressBlock_element Address=new GsdAtpStream.AddressBlock_element ();
        GsdAtpStream.InPartList_element InPart=new GsdAtpStream.InPartList_element();
        GsdAtpStream.GetATPResponseType Res=new GsdAtpStream.GetATPResponseType();
        GsdAtpStream.PartList_element PartElement=new GsdAtpStream.PartList_element();
        GsdAtpStream.PortTypeEndpoint1  port=new GsdAtpStream.PortTypeEndpoint1();
        GsdAtpStream.FaultMessageType Msg=new GsdAtpStream.FaultMessageType();
         GSD_Integration_Data__c GSDI=new  GSD_Integration_Data__c(name='ATP',End_point_URL__c='https://it-services-gw-csc-stg.itcs.hp.com/gw/hpit/egit/getatp.itg',Time_out__c=120000,Client_Certificate__c='');
         insert GSDI;
           
        GSDIntegrationUtilityClass objIntegrationData = new GSDIntegrationUtilityClass();
           string strServicename='ATP';
           objIntegrationData.GetEndpointData(strServicename);
       test.startTest();
       Test.setMock(WebServiceMock.class, new GsdAtpStreamWebMockIml()); 
        POCObj.checkAvail();
        POCObj.partlineid=partorderline.id;
        POCObj.checkAvailSupressEqualent();
       test.stopTest();
    }
   
    
}
can some one tel me how to resolve this issue.
Regards
Lakshman