• Soumya Srivastava 1
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Senior Software Engineer
  • Zensar Technologies ltd.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 21
    Replies
 public ecEuropaEuTaxudViesServicesCheckva.checkVatResponse_element checkVat(String countryCode,String vatNumber)
        {
            ecEuropaEuTaxudViesServicesCheckva.checkVat_element request_x = new ecEuropaEuTaxudViesServicesCheckva.checkVat_element();
            request_x.countryCode = countryCode;
            request_x.vatNumber = vatNumber;
            ecEuropaEuTaxudViesServicesCheckva.checkVatResponse_element response_x;
            Map<String, ecEuropaEuTaxudViesServicesCheckva.checkVatResponse_element> response_map_x = new Map<String, ecEuropaEuTaxudViesServicesCheckva.checkVatResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                    '',
                    'urn:ec.europa.eu:taxud:vies:services:checkVat:types',
                    'checkVat',
                    'urn:ec.europa.eu:taxud:vies:services:checkVat:types',
                    'checkVatResponse',
                    'ecEuropaEuTaxudViesServicesCheckva.checkVatResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }

I am unable to debug the error coming with my test class for the below method which is there. Can anyone ehlp on this ASAP.
Hi,

I am facing issue with my test class where the formula field having return type Boolean is not getting covered even though we have passed the correct data set for old and new values of the record. We have to cover the eligibleforRR(oldWorkOrder,newWorkOrder) , where we are not able to bypass this formula field condition.
  @TestVisible private static Boolean isEligibleForRR( WorkOrder oldWo, WorkOrder wo  )
    {
        Boolean isEligible = false;
        System.debug(LoggingLevel.WARN, '---> isEligibleForRR; oldWo: ' + oldWo );
        System.debug(LoggingLevel.WARN, '---> isEligibleForRR; wo: ' + wo);

        if ( wo != null )
        {
            System.debug(LoggingLevel.WARN, '---> Check Salesforce Assigned Date:' + wo.SalesforceDateAssigned__c );
            System.debug(LoggingLevel.WARN, '---> incoming line item count: ' + wo.IncomingWOLineCount__c );          
            System.debug(LoggingLevel.WARN, '---> Do_Vendor_Assignment__c :' + wo.Do_Vendor_Assignment__c ); FORMULA FIELD with Boolean return type.
            System.debug(LoggingLevel.WARN, '---> wo vendor: ' + wo.Vendor__c );
            System.debug(LoggingLevel.WARN, '---> dummy vendor: ' + settings.Dummy_Vendor_Id__c );
        }

        if (wo.Do_Vendor_Assignment__c && DisplayUtils.hasChanged(oldWO, wo, 'Do_Vendor_Assignment__c'))
        {
            isEligible = true;
        }

        System.debug(LoggingLevel.WARN, '---> returning isEligible: ' + isEligible);
        return isEligible;
    }

FORMULA Field : Do_Vendor_Assignment__c
Data TypeFormula  
IF ( 
AND( 
LineItemCount = IncomingWOLineCount__c(rool up on WOLI), 
Vendor__c = $Setup.Vendor_Assignment_Configs__c.Dummy_Vendor_Id__c(Custom setting), 
Has_run_assignment_process__c=FALSE(boolean flag), 
ISPICKVAL(WOStatus__c, "Pending Vendor Acceptance") || 
ISPICKVAL(WOStatus__c, "Pending Assignment") 

, TRUE 
, FALSE 
)

Can anyone help me increasing the test coverage of my test class and with this issue which is on very high priority at the moment.

Thanks,
Soumya
Hi,

I am not able to bind map values on my Vf page perfectly I am getting related list name only not its fields that too dynamically i am getting those data.

Now the problem is with the binding.

  <apex:pageBlock>
    <apex:form>
           <apex:repeat value="{!mapOfRelatedListFields}" var="key">  
                <apex:outputText value="{!key}"/> <br/>
                <apex:repeat value="{!mapRelatedList[key]}" var="dd">
                    <apex:outputText value="{!dd}"/> <br/>             
                
                 </apex:repeat>
           </apex:repeat>
            
        </apex:pageBlock>
    </apex:form>




            for(String s:mapOfRelatedListFields.keySet()){
              
                  String relatedFields = string.ValueOf(mapOfRelatedListFields.get(s)).removeStart('(').removeEnd(')');
                  
                  System.debug('relatedFields====='+relatedFields);

                  
                  commaSepratedFields = commaSepratedFields +', (select  ' + relatedFields + ' from ' + s +' )'; 
                  strList.add(s);
                  
         
              } 
            
            
           /* -----------  making the query to execute ---------- */
            query = 'select ' + commaSepratedFields + ' from ' + SobjectApiName + ' Where ID = \''+ String.escapeSingleQuotes(obj)+'\'';   
           System.debug(query);
    
           recDetail = Database.query(query);
           system.debug('The record details are:-'+recDetail);
           
           mapRelatedList = new Map<String, List<sObject>>();
             
            for(String str: strList){
            
                if(recDetail.getSObjects(str) == null){
                    mapRelatedList.put(str, new List<sObject>());
                }
                else{
                    mapRelatedList.put(str, recDetail.getSObjects(str));
                }

Please let me know if anybody has an idea about it.

Thanks,
Soumya
 
Hi,

I am not getting data through dynamic soql in apex through database.query.
              
                  String query = 'select (select ' + relatedFields + ' from ' + s +' ) from Contact Where ID = \'0036F000022zMpg\'';  

Whenever, I am accessing relatedList fields to access data it is returning me Contact:{Id=0036F000022zMpgQAE}} in this format which is the key. Please let me know if any of you have any idea to access related list data from any sObject through Dynamic Soql.

Thanks,
Soumya      
                  
        
Hi,

I am not getting a damaged PDF when downloading it from attachment from a Quote object in lighting while same is working in classic. Can you please let me know what will be the appropriate steps to resolve damaged PDF issue as soon as possible.

Thanks,
Soumya
Hi,

I have a problem with PageReference in lightning where I am not able to get the content in the attachment with PDF when we open it. I am using standard conrtroller of Opportunity and redirecting to another Vf Page where I am using standard controller of Quote where PDF has been generated and attached in attached.
I am getting a damaged PDF in Salesforce1 and getting content in Salesforce Classic. Can anybody , please help on this.

Thanks,
Soumya
Hi,

I have an issue with PDF content as we have created an autmation process where we have created quick action on opportunity tab which is creating  quotes and quotelineitem and then redirecting to another VF page having Quote as standard controller and generating PDF. We are not getting the whole content in the attached on Quote Object whose id we are passing in attachment in the below part of code.

We are calling attachQuote method from action of a VF page(Parent) :

 /* The action method that will generate a PDF document from the QuotePDF page and attach it to 
       the quote provided by the standard controller. Called by the action binding for the attachQuote
       page, this will do the work and take the user back to the quote detail page. */
        public PageReference attachQuote() {
        /* Get the page definition */
        PageReference pdfPage = Page.quotePDF;
        
        /* set the quote id on the page definition */
        pdfPage.getParameters().put('id',q.id);
        Blob  pdfBlob;
        /* generate the pdf blob */
        if(test.isRunningTest())
        {
        pdfBlob =Blob.valueof('UNIT.TEST');
        }
        else
        pdfBlob = pdfPage.getContent();
        
        System.Debug('Checking ID 1 : ' + q.id);
        /* create the attachment against the quote */
        Attachment a = new Attachment(parentId = q.id, name=q.Quote_Number__c+'.pdf', body = pdfBlob,contentType = 'application/pdf',isPrivate=false);      
        /* insert the attachment */
        System.Debug('Checking ID 2 : ' + q.id);
        insert a;
       
   return controller.view();      
    }
    
Please let me know if anything is required and please do suggest as we are using getContent() but the data is not there in it, although i am fetching the Quoteid.

Thanks,
Soumya
Hi All,
I was trying to create test class of one of my apex class. Can you help me out in writing the same as I am facing difficulties in writing the same. In this Application__c is the custom object with fields as there in the query. In which outcome fields are picklist fields.

Test Class
@isTest
public class Update_InterviewDetailsTest{
    static integer batchsiz = 80; 
    static List < Application__c > testApplication = new List < Application__c > ();
    
    public static List<Date> X1st_Interview_Date = new List<Date>();
    public static List<Date> X2nd_Interview_Date = new List<Date>();
    public static List<Date> X3rd_Interview_Date = new List<Date>();
    public static List<string> X1st_Interview_Time = new List<string>();
    public static List<string> X2nd_Interview_Time = new List<string>();
..................................................
    
 static void setUp()
    {
        createApplicationRecords();
    } 
 static void createApplicationRecords(){
       Application__c ap = new Application__c();
         for(integer i=0;i<batchsiz;i++){         
     
                ap.X1st_Interview_Date__c = X1st_Interview_Date[i];
                ap.X1st_Interview_Time__c = X1st_Interview_Time[i];
                ap.X1st_Interview_Outcome__c = X1st_Interview_Outcome[i];
                ap.X2nd_Interview_Date__c = X2nd_Interview_Date[i];         
              .............................................................
         }
       Test.startTest();
   {         
        insert ap;
   }
  Test.stopTest();        
       PageReference pageRef = Page.Update_Interview;
       Test.setCurrentPage(pageRef);         
        
        ApexPages.StandardController sc = new ApexPages.StandardController(ap);
        UpdateInterviewDetails uids = new UpdateInterviewDetails(sc); 
        String nextPage = uids.save().getUrl();
        // Verify that page fails without parameters
        System.assertEquals('/apex/failure?error=noParam', nextPage);
       
        // Add parameters to page URL            
        ApexPages.currentPage().getParameters().put('Id',String.valueOf(ap.id)); 
        String aId = ApexPages.currentPage().getParameters().get('id');          
        uids.waitapplication();
        uids.save();         
            
  }
  
public static testmethod void myunittest(){
    
 setup();

  System.AssertEquals(testApplication.size(), 80, 'Incorrect number of Test Applicaiton Created.');
    
    for(Integer i=0;i<batchsiz;i++){
        System.assertEquals(testApplication[i].X1st_Interview_Outcome__c,X1st_Interview_Outcome[i]);
        System.assertEquals(testApplication[i].X2nd_Interview_Outcome__c,X2nd_Interview_Outcome[i]);
        System.assertEquals(testApplication[i].X3rd_Interview_Outcome__c,X3rd_Interview_Outcome[i]);  
        }
  }     
}
Hi,

I am not getting data through dynamic soql in apex through database.query.
              
                  String query = 'select (select ' + relatedFields + ' from ' + s +' ) from Contact Where ID = \'0036F000022zMpg\'';  

Whenever, I am accessing relatedList fields to access data it is returning me Contact:{Id=0036F000022zMpgQAE}} in this format which is the key. Please let me know if any of you have any idea to access related list data from any sObject through Dynamic Soql.

Thanks,
Soumya      
                  
        
Hi,

I am not getting a damaged PDF when downloading it from attachment from a Quote object in lighting while same is working in classic. Can you please let me know what will be the appropriate steps to resolve damaged PDF issue as soon as possible.

Thanks,
Soumya
Hi,

I have a problem with PageReference in lightning where I am not able to get the content in the attachment with PDF when we open it. I am using standard conrtroller of Opportunity and redirecting to another Vf Page where I am using standard controller of Quote where PDF has been generated and attached in attached.
I am getting a damaged PDF in Salesforce1 and getting content in Salesforce Classic. Can anybody , please help on this.

Thanks,
Soumya
Hi,

I have an issue with PDF content as we have created an autmation process where we have created quick action on opportunity tab which is creating  quotes and quotelineitem and then redirecting to another VF page having Quote as standard controller and generating PDF. We are not getting the whole content in the attached on Quote Object whose id we are passing in attachment in the below part of code.

We are calling attachQuote method from action of a VF page(Parent) :

 /* The action method that will generate a PDF document from the QuotePDF page and attach it to 
       the quote provided by the standard controller. Called by the action binding for the attachQuote
       page, this will do the work and take the user back to the quote detail page. */
        public PageReference attachQuote() {
        /* Get the page definition */
        PageReference pdfPage = Page.quotePDF;
        
        /* set the quote id on the page definition */
        pdfPage.getParameters().put('id',q.id);
        Blob  pdfBlob;
        /* generate the pdf blob */
        if(test.isRunningTest())
        {
        pdfBlob =Blob.valueof('UNIT.TEST');
        }
        else
        pdfBlob = pdfPage.getContent();
        
        System.Debug('Checking ID 1 : ' + q.id);
        /* create the attachment against the quote */
        Attachment a = new Attachment(parentId = q.id, name=q.Quote_Number__c+'.pdf', body = pdfBlob,contentType = 'application/pdf',isPrivate=false);      
        /* insert the attachment */
        System.Debug('Checking ID 2 : ' + q.id);
        insert a;
       
   return controller.view();      
    }
    
Please let me know if anything is required and please do suggest as we are using getContent() but the data is not there in it, although i am fetching the Quoteid.

Thanks,
Soumya
Hi All,
I was trying to create test class of one of my apex class. Can you help me out in writing the same as I am facing difficulties in writing the same. In this Application__c is the custom object with fields as there in the query. In which outcome fields are picklist fields.

Test Class
@isTest
public class Update_InterviewDetailsTest{
    static integer batchsiz = 80; 
    static List < Application__c > testApplication = new List < Application__c > ();
    
    public static List<Date> X1st_Interview_Date = new List<Date>();
    public static List<Date> X2nd_Interview_Date = new List<Date>();
    public static List<Date> X3rd_Interview_Date = new List<Date>();
    public static List<string> X1st_Interview_Time = new List<string>();
    public static List<string> X2nd_Interview_Time = new List<string>();
..................................................
    
 static void setUp()
    {
        createApplicationRecords();
    } 
 static void createApplicationRecords(){
       Application__c ap = new Application__c();
         for(integer i=0;i<batchsiz;i++){         
     
                ap.X1st_Interview_Date__c = X1st_Interview_Date[i];
                ap.X1st_Interview_Time__c = X1st_Interview_Time[i];
                ap.X1st_Interview_Outcome__c = X1st_Interview_Outcome[i];
                ap.X2nd_Interview_Date__c = X2nd_Interview_Date[i];         
              .............................................................
         }
       Test.startTest();
   {         
        insert ap;
   }
  Test.stopTest();        
       PageReference pageRef = Page.Update_Interview;
       Test.setCurrentPage(pageRef);         
        
        ApexPages.StandardController sc = new ApexPages.StandardController(ap);
        UpdateInterviewDetails uids = new UpdateInterviewDetails(sc); 
        String nextPage = uids.save().getUrl();
        // Verify that page fails without parameters
        System.assertEquals('/apex/failure?error=noParam', nextPage);
       
        // Add parameters to page URL            
        ApexPages.currentPage().getParameters().put('Id',String.valueOf(ap.id)); 
        String aId = ApexPages.currentPage().getParameters().get('id');          
        uids.waitapplication();
        uids.save();         
            
  }
  
public static testmethod void myunittest(){
    
 setup();

  System.AssertEquals(testApplication.size(), 80, 'Incorrect number of Test Applicaiton Created.');
    
    for(Integer i=0;i<batchsiz;i++){
        System.assertEquals(testApplication[i].X1st_Interview_Outcome__c,X1st_Interview_Outcome[i]);
        System.assertEquals(testApplication[i].X2nd_Interview_Outcome__c,X2nd_Interview_Outcome[i]);
        System.assertEquals(testApplication[i].X3rd_Interview_Outcome__c,X3rd_Interview_Outcome[i]);  
        }
  }     
}

I'm having a hard time writing a test method for a custom object that has Formula Fields on them that are being used in the methods I am trying to cover.

 

When I debug the fields in the test method they are coming up as null, but, if I query the record it shows those fields as being updated correctly.

 

Where I run into a problem is when I have nested formula fields and then pass the final record I want tested to the method via a trigger.  The field that starts at the top level of the hierarchy hasn't made it all of the way to the final record.

 

Is there something I'm missing or do I need to query each and every object before associating it to the next in the hierarchy?  The final record doesn't have a direct reference to the fields in question but the class queries them based on a set criteria.

 

Any help would be appreciated.  Thanks!