• Sarada RVS 2
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
I have added client .jks file into salesforce as CA certificate.
Below is the request i have used ,.It gives 200 response but error in debig log : "Unable to send authentication token"
   
   Http h = new Http();
        HttpRequest req = new HttpRequest();        
        req.setEndpoint('https://secure.wasp.uat.uk.experian.com/WASPAuthenticator/tokenService.asmx ');
        req.setClientCertificateName('ncfltddsuat01u');
        req.setMethod('POST');
        req.setTimeout(120000);
        req.setHeader('SOAPAction','http://www.uk.experian.com/WASP/LoginWithCertificate');
        req.setHeader('Content-Type', 'text/xml; charset=utf-8');
        req.setBody('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body><LoginWithCertificate><application>WASP TEST</application><checkIP>true</checkIP></LoginWithCertificate></Body></Envelope>');
         HttpResponse res = h.send(req);
        system.debug(res.getBody());  

Please assist me in this.???
Hi,

I am unable to deploy my code due to null pointer exception.
Could anyone help me please.
Below is the my controller and test class.

Controller wit the method iam testing

public PageReference saveTOLead()
    {
        showrefreshblck = true;
        shouldRedirect = true;
     
        Lead acc = new Lead(id=a.id);
        
        
        redirectUrl = controller.view().getUrl();
        
        getRatings(acc.Id,allCompDetails[selectedrow].companyId);
        
        
        acc.Company_Registration_Number__c = allCompDetails[selectedrow].RegistrationNumber;
        acc.Company =  allCompDetails[selectedrow].Company;
        acc.is_saved_prev__c = true;
        acc.Company_Id__c = allCompDetails[selectedrow].companyId;
        
        List<String> addrArray = allCompDetails[selectedrow].Address.split(',');
        Map<Integer,String> accMap = new Map<Integer,String>();
        Integer n= addrArray.size();
        for(Integer l=0;l<addrArray.size();l++)
        {
            accMap.put(l, addrArray[l]);
        }
        
        acc.Street = accMap.get(0);  
        
        acc.City =  accMap.get(1);
        acc.State = accMap.get(2); 
        
        acc.PostalCode = allCompDetails[selectedrow].postalCode;
        acc.Company_Status__c =    allCompDetails[selectedrow].status;
        acc.CompanyType__c =allCompDetails[selectedrow].type;
        
     
        
        showPgblck = false;
       return null;
      
    }
    
Test class witht the piece which testes the method

 public static testMethod void testLeadRatings() {
        Test.setMock(HttpCalloutMock.class, new MockHttpResGenFetchLeadDetailsRatings());
        Lead l = new Lead();
        l.FirstName = 'FirstName1';
        l.LastName = 'LastName1';
        l.MobilePhone = '074434567890';
        l.Company = 'Traves1';
       
        insert l;

        test.startTest();

        PageReference pageRef = Page.Lead_DisplayCompany; //FC_VF
        Test.setCurrentPage(pageRef);                    
        pageRef.getParameters().put('id',l.id);
        ApexPages.StandardController sc = new ApexPages.StandardController(l);

        LeadFetchCompanyDetails fc = new LeadFetchCompanyDetails(sc);
        LeadFetchCompanyDetails.CompanyDetails cd = new LeadFetchCompanyDetails.CompanyDetails();
        cd.companyid = 'GB003/0/07375960';
        cd.RegistrationNumber='07375960';
        cd.Address = 'Test.test,test';                
        cd.Company = 'Traves';
        cd.postalCode ='HA02RX';
        cd.Status ='Active';
        cd.Type= 'Ltd';

 
        fc.allCompDetails.add(cd);
        // fc.selectedrow = 0;

        system.assert(fc!=null);
        fc.saveTOLead();
        
        LeadFetchRatingDetails.CompanyDetails lfrd = new LeadFetchRatingDetails.CompanyDetails ();
        LeadFetchRatingDetails.contactWrapper cw = new LeadFetchRatingDetails.contactWrapper();
        test.stopTest();
    }
    
   
I have added client .jks file into salesforce as CA certificate.
Below is the request i have used ,.It gives 200 response but error in debig log : "Unable to send authentication token"
   
   Http h = new Http();
        HttpRequest req = new HttpRequest();        
        req.setEndpoint('https://secure.wasp.uat.uk.experian.com/WASPAuthenticator/tokenService.asmx ');
        req.setClientCertificateName('ncfltddsuat01u');
        req.setMethod('POST');
        req.setTimeout(120000);
        req.setHeader('SOAPAction','http://www.uk.experian.com/WASP/LoginWithCertificate');
        req.setHeader('Content-Type', 'text/xml; charset=utf-8');
        req.setBody('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body><LoginWithCertificate><application>WASP TEST</application><checkIP>true</checkIP></LoginWithCertificate></Body></Envelope>');
         HttpResponse res = h.send(req);
        system.debug(res.getBody());  

Please assist me in this.???
Hi,

I am unable to deploy my code due to null pointer exception.
Could anyone help me please.
Below is the my controller and test class.

Controller wit the method iam testing

public PageReference saveTOLead()
    {
        showrefreshblck = true;
        shouldRedirect = true;
     
        Lead acc = new Lead(id=a.id);
        
        
        redirectUrl = controller.view().getUrl();
        
        getRatings(acc.Id,allCompDetails[selectedrow].companyId);
        
        
        acc.Company_Registration_Number__c = allCompDetails[selectedrow].RegistrationNumber;
        acc.Company =  allCompDetails[selectedrow].Company;
        acc.is_saved_prev__c = true;
        acc.Company_Id__c = allCompDetails[selectedrow].companyId;
        
        List<String> addrArray = allCompDetails[selectedrow].Address.split(',');
        Map<Integer,String> accMap = new Map<Integer,String>();
        Integer n= addrArray.size();
        for(Integer l=0;l<addrArray.size();l++)
        {
            accMap.put(l, addrArray[l]);
        }
        
        acc.Street = accMap.get(0);  
        
        acc.City =  accMap.get(1);
        acc.State = accMap.get(2); 
        
        acc.PostalCode = allCompDetails[selectedrow].postalCode;
        acc.Company_Status__c =    allCompDetails[selectedrow].status;
        acc.CompanyType__c =allCompDetails[selectedrow].type;
        
     
        
        showPgblck = false;
       return null;
      
    }
    
Test class witht the piece which testes the method

 public static testMethod void testLeadRatings() {
        Test.setMock(HttpCalloutMock.class, new MockHttpResGenFetchLeadDetailsRatings());
        Lead l = new Lead();
        l.FirstName = 'FirstName1';
        l.LastName = 'LastName1';
        l.MobilePhone = '074434567890';
        l.Company = 'Traves1';
       
        insert l;

        test.startTest();

        PageReference pageRef = Page.Lead_DisplayCompany; //FC_VF
        Test.setCurrentPage(pageRef);                    
        pageRef.getParameters().put('id',l.id);
        ApexPages.StandardController sc = new ApexPages.StandardController(l);

        LeadFetchCompanyDetails fc = new LeadFetchCompanyDetails(sc);
        LeadFetchCompanyDetails.CompanyDetails cd = new LeadFetchCompanyDetails.CompanyDetails();
        cd.companyid = 'GB003/0/07375960';
        cd.RegistrationNumber='07375960';
        cd.Address = 'Test.test,test';                
        cd.Company = 'Traves';
        cd.postalCode ='HA02RX';
        cd.Status ='Active';
        cd.Type= 'Ltd';

 
        fc.allCompDetails.add(cd);
        // fc.selectedrow = 0;

        system.assert(fc!=null);
        fc.saveTOLead();
        
        LeadFetchRatingDetails.CompanyDetails lfrd = new LeadFetchRatingDetails.CompanyDetails ();
        LeadFetchRatingDetails.contactWrapper cw = new LeadFetchRatingDetails.contactWrapper();
        test.stopTest();
    }
    
   
I have a twe date/time fields: Date1__c and Date2__c.

I need to calculate working days between two date/time field excluding weekends with fraction value.

Eg., Date1__c = '2015 - 07 - 08 13:00'
        Date2__c = '2015 - 07 - 10 15:00'
        difference: 2.08

Hi guys,

I need opinion on how I can achieve the required functionality.

I have a custom object A that stores user progress details every month. When a new record is added next month I want to copy user’s previous month’s scorer to newly added record. I nut shall I want to have users previous month’s score into the current month record in custom field.

 

Am I right to think that I need before insert trigger to achieve it. But don’t know how I can save previous month’s score in the trigger temporarily and then added to new record. Any help?

 

Thanks,

I am trying to clone attachments from opportunities to a custom object.

Once I create the custom object from the opportunity page I would like to have all the attachments from the opportunity cloned in the new related record.

 

Any idea or sample code for this?

 Thank you!!!

The following formula will calculate the number of working days (inclusive) between 2 dates. A working day is defined as Monday to Friday. Even if the start or end dates are a weekend, these are accommodated.

IF(AND((5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( End_Date__c  -   Start_Date__c ) + 1) < 7)),
((CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( End_Date__c  -  Start_Date__c ) - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0))))


The Start Date and End Date fields are custom in the above example and can be replaced as required. If use of a DateTime field is required then the DATEVALUE function will be required.

I also recommend a simple field validation rule is added to check that the End Date is after the Start Date.
  • January 05, 2009
  • Like
  • 9