• Himanshu Patel 55
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 3
    Replies
Hello Everyone, 

Due to Covid 19 we had to stop our automated process sending Orders to Distributors and now we want to reactivate but data volume is high so it seems Schedule Apex Job is not able to send data.  

Is there a way to know what data is processed by Shceduled Job?

I have reduced Bach size in Schedule Apex from 1000 to 1 but not able to send to Prod as I dont know which test class should I use. There should be a test class for Apex class of Batchable Apex? 

I tried with debug log but did not came up anything. 

Let me know you throughts.

Thanks in advance
Hi, 

We have a need to update one of new field in Case so that data shows up in Portal we recently launched. 

When i am trying to update cases through data loader, it's not allow me to edit in mass. However i can do this individually. 

Is there a way to mass unlock records to update existing field. 

thanks in advance.

Hi Guys, 

I am having a problem with Auto Approval process when case is created from Customer Community. This process was designed few years ago and working fine until last week. Suddently Auto approval functionality not working. 

Below is from debug log 

11:06:36.0 (789572586)|WF_RULE_FILTER|[Case : Case Record Type equals Vet Refusal, Complaint] AND
 ([Case : Case Origin equals Veterinary Portal] OR
 ([Case : Case Origin equals Web form] AND
 [Account : Account Record Type equals Veterinarian, Veterinarian School]))
11:06:36.0 (789599544)|WF_RULE_EVAL_VALUE|01250000000Qn2F
11:06:36.0 (790013307)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790025657)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790038537)|WF_RULE_EVAL_VALUE|0121T000000ARoR
11:06:36.0 (790050307)|WF_EVAL_ENTRY_CRITERIA|Palatability Refusals Process|00X50000001a8hG|false
11:06:36.0 (790087611)|WF_PROCESS_FOUND||No applicable approval process was found.
11:06:36.0 (790841041)|CODE_UNIT_FINISHED|Workflow:ApprovalProcessActions
11:06:36.0 (790980116)|DML_END|[251]
11:06:36.0 (791029629)|EXCEPTION_THROWN|[251]|System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
11:06:36.0 (791458699)|HEAP_ALLOCATE|[251]|Bytes:127
11:06:36.0 (791511759)|VARIABLE_SCOPE_BEGIN|[257]|e|System.DmlException|true|false
11:06:36.0 (791603768)|VARIABLE_ASSIGNMENT|[257]|e|"common.apex.runtime.impl.DmlExecutionException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []"|0x30f3a637

(791710185)|USER_DEBUG|[258]|DEBUG|PalatabilityRefusal_NewCaseController: Exception while submitting for approval: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
below is from Controller page

 
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Auto-Submitted by controller for Approval.');
        req1.setObjectId(thisCase.id);
        
        System.debug('PalatabilityRefusal_NewCaseController:  Process Approval Request: '+ req1);
        Approval.ProcessResult result;
        try{
            result = Approval.process(req1);
            if (!result.isSuccess()){
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'An Error Occurred when submitting the request.  Please contact your administrator.'));
                return (null);
            }
            System.debug('PalatabilityRefusal_NewCaseController: Successfully submitted for approval.');
        }catch(System.DMLException e){
            System.debug('PalatabilityRefusal_NewCaseController: Exception while submitting for approval: '+e);
            System.debug('PalatabilityRefusal_NewCaseController: Exception trace: '+e.getStackTraceString());
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLId(0));
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLFields(0));
            System.debug(thisCase);
            hasErrors = true;
            ApexPages.addMessages(e);
            return (null);
        }
W

We used to receive message in Approval Process Comments that "Auto-Submitted by controller for Approval." but right now we have to manually submit it. It's working fine in manual Approval. 

Somehow it stopped working through Controller. Let me know if you need more details to understand it better. 

What do you suggest. 

Thanks in advance. 
Hello There, I am getting Assertion Failed error in Test Class. Can you please help me to understand why getting this error. 

Thank you in advance. Below is code.

@IsTest

private with sharing class TestFastForms_GeneratePrefillLink_test{

@IsTest

  private static void testLeadTriggerViaDML()

{ Test.startTest();

Lead testLead = new Lead(FirstName  =  'Test', LastName  =  'Contact',Company='XYZ’,LeadStatus = ’Open’, Email  =  ’testlead@company.com' );

// All code in your test class is only simulated and no new records are actually created. 

// This line must be changed to create a record of your primary object. All required fields on the primary object must be included. If you have a required lookup field on this object then it must be set to the id of an existing record in your org of the object type of your lookup field.

insert testlead;

System.assert(Limits.getFutureCalls()>0);

Test.stopTest();

  }

}
 
We have recently purchased a E Learning Application and wanted to link Community portal so that Portal users can click on particular link which will click Visualforce Tab and redirect to new application. 

Most of code is already in place as i am moving from one application to other. I dont know how to use Visualforce Tab in below visualforce page. 

<p><a href="{!wmURL}" target="_blank" class="btn btn-primary">{!$Label.lbl_vetPortal_WeightManagementLogin} &rarr;</a></p>

!wmURL has a logic in Controller of old application. I want to use Visualforce Tab when user click on above link. 
apex:page docType="html-5.0" showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="false" controller="ctl_PortalWeightManagement" action="{!getUrlForUser}">
    <apex:composition template="vetPortal2015Template">
		<apex:define name="content">
			<div class="row">
				<c:vetPortalLearningCenterNav />			
            	<div class="container col-sm-11">
		            <header class="page-header">
		            	<h1>{!$Label.hdr_VetPortal_WeightManagement}</h1>
		            </header>
					
					<div class="pull-right-img">
						<img class="img-responsive" src="{!URLFOR($Resource.vetPortal2, 'images/cundari/boxer.png')}" />
					</div>
					<p><apex:outputText escape="false" value="{!$Label.txt_vetPortal_WeightManagementContent}" /></p>
					<p><a href="{!wmURL}" target="_blank" class="btn btn-primary">{!$Label.lbl_vetPortal_WeightManagementLogin} &rarr;</a></p> [I am looking for change here as this was used for login to old application]
				</div>
			</div><!-- row -->
        </apex:define>
        <apex:define name="scripts">
			<script type="text/javascript">
				$(function() {
				});
			</script>
        </apex:define>
    </apex:composition>
</apex:page>

Seeking your help here. Thanks in Advance. 
Hello, I am seeking for help in changing URL from one application to another. 

Currently we have SSO implemented from Community portal by clicking on LOGIN button in one of page where user is directed to another application. Below is line where i want to update URL <a href="{!wmURL} . How can i find this URL in salesforce

<p><a href="{!wmURL}" target="_blank" class="btn btn-primary">{!$Label.lbl_vetPortal_WeightManagementLogin} &rarr;</a></p> 

2) I have one of existing tab in salesforce which i want to call when click on LOGIN button. Please advice how to accomplish this. 

Thanks for you help in advance.
Hello Everyone,

My test class is failing and I can't figure out why. Any assistance is greatly appreciated.

This is the error message:

System.QueryException: List has no rows for assignment to SObject

Method 1: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.AAAAAAAAAAAAAAAtestInsert: line 126, column 1

Method 2: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.testInsertContactNotMatched: line 155, column 1

Method 3: System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.portalRequestControllerTests.testMisMatchedAccount: line 184, column 1

Method 4: System.AssertException: Assertion Failed: Same value: null 
Stack Trace: Class.portalRequestControllerTests.testVeterinarianSchool: line 24, column 1

Method 5: System.AssertException: Assertion Failed: Same value: null 
Stack Trace: Class.portalRequestControllerTests.test_method_one: line 46, column 1

This is the test class as a whole:

@isTest
private class portalRequestControllerTests {
  
  @isTest static void testVeterinarianSchool() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
    RecordType rt             = [select Id from RecordType where SObjectType = 'Account' and Name  = 'Veterinarian School'];

      Account a    = new Account(Name='Test Account', RecordTypeId = rt.Id, Active__c = true, Account_Classification__c = 'School');
      insert a;


    List<Account> searchList       = portalRequestController.lookupAccount('Test Account');
    System.assertEquals(searchList.size(), 1);

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.clinicId           = portalRequestController.lookupAccount('Test Account')[0].Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = ctlr.getLanguageOptions()[0].getValue();

      ctlr.createRequest();
      System.assertNotEquals(ctlr.pr.Id, null);

  }


  @isTest static void test_method_one() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

        Account a    = new Account(Name='Test Account', RecordTypeId = slimfitUtils.getClinicAccountRecordType().Id, Active__c = true, Account_Classification__c = 'School');
        insert a;

      ctlr.createRequest();

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.clinicId           = portalRequestController.lookupAccount('Test Account')[0].Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = ctlr.getLanguageOptions()[0].getValue();

      ctlr.createRequest();
      System.assertNotEquals(ctlr.pr.Id, null);
  }
  

  @isTest static void test_rejection() {
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.createRequest();

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = 'test@mailinator.com';
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';

      ctlr.createRequest();
      System.assertEquals(ctlr.pr.Id, null);
  }



  @isTest static void testExistingPortalRequest() {
      Account a    = new Account(Name='Test Account');
      insert a;

        Portal_Request__c portalReqObj1           = new Portal_Request__c ();
        portalReqObj1.First_Name__c   = 'TestFirstName1';
        portalReqObj1.Last_Name__c     = 'TestLastName';
        portalReqObj1.Status__c        = 'New';
        portalReqObj1.Clinic__c       = a.id;
        portalReqObj1.Email_Address__c   = 'TestMail@testing.com';
        insert portalReqObj1;

    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.pr.First_Name__c       = 'Joe';
      ctlr.pr.Last_Name__c       = 'Test';
      ctlr.pr.Email_Address__c     = portalReqObj1.Email_Address__c;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';

      ctlr.createRequest();
      System.assertEquals(ctlr.pr.Id, null);
  }



    static testMethod void AAAAAAAAAAAAAAAtestInsert() {
    // prod
    ExactTarget_Settings__c settings = new ExactTarget_Settings__c(
      accessToken__c='bg5ccutef4qqcdxkjk63bd2u', 
      accessToken_Expiration_Date__c = Datetime.now().addYears(1),
      TriggeredSendEmail_Endpoint__c = 'https://www-exacttargetapis-com-nhz9abyp4su1.runscope.net/messaging/v1/messageDefinitionSends/key:%7B0%7D/send?access_token={1}',
      requestToken_EndPoint__c = 'https://auth.exacttargetapis.com/v1/requestToken',
      clientSecret__c = 'k6fs4dkvJr6XC3Uzw4yxVrYT',
      clientId__c = 'xdf5ehwugdv5afpybxrda9uq'
    );
    // dev
    //TMSSettings__c settings = new TMSSettings__c(Blocked_Off_Record_Type_ID__c=blackoutRecordTypeId, Shipment_Record_Type_ID__c=shipmentRecordTypeId, Carrier_New_Ship_Email_Template_ID__c='00XW0000000I8juMAC', Carrier_Profile_ID__c='00eW0000000QMpFIAW', Carrier_Updated_Ship_Email_Template_ID__c='00XW0000000I8jpMAC', From_Email_Notification_ID__c='0D250000000TN1PCAW', Portal_Domain_Name__c='  royalcanincanada.force.com', TMS_RC_Notification_Group_ID__c='00G50000001jledEAA', Warehouse_Address__c='Any street, Toronto', Warehouse_Phone__c='9056667890', Warehouse_Profile_ID__c='01IW0000000D4fx' , POD_Logistics_Email_Template_ID__c='00XW0000000I9xxMAC', POD_Carrier_Email_Template_ID__c='00XW0000000I9xsMAC');
    insert settings;

      Account a    = new Account(Name='Test Account');
      insert a;
        Account a1    = [select Id, OwnerId from Account where Id = :a.Id];

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = a.Id, RecordTypeId = slimfitUtils.getClinicVetRecordType().Id, Vet_Portal_Welcome_Sent__c = true);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));

      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      //System.assertEquals(pr.Status__c, 'Approved');
      System.assertEquals(pr.Clinic__c, a.Id);

    Contact cCheck     = [select Id, FirstName, Vet_Express_Consent__c from Contact where Id = :c.Id];
    System.assertEquals(cCheck.FirstName, ctlr.pr.First_Name__c);
    System.assertEquals(cCheck.Vet_Express_Consent__c, true);
    }


    static testMethod void testInsertContactNotMatched() {
      Account a    = new Account(Name='Test Account');
      insert a;
        Account a1    = [select Id, OwnerId from Account where Id = :a.Id];

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = a.Id);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Contact__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      System.assertEquals(pr.Contact__c, null);
      System.assertEquals(pr.Clinic__c, a.Id);

    Contact cCheck     = [select Id, FirstName, Vet_Express_Consent__c from Contact where Id = :c.Id];
    System.assertNotEquals(cCheck.FirstName, ctlr.pr.First_Name__c);
    System.assertNotEquals(cCheck.Vet_Express_Consent__c, true);
    }


    static testMethod void testMisMatchedAccount() {
      Account a    = new Account(Name='Test Account');
      Account b     = new Account(Name='B Account');
      insert new List<Account> { a, b };

        Contact c    = new Contact(FirstName = 'first', LastName = 'last', Email = 'test@me.com', AccountId = b.Id);
        insert c;
        
    portalRequestController ctlr     = new portalRequestController(new ApexPages.StandardController(new Portal_Request__c() ));
      ctlr.pr.First_Name__c       = 'Arthur';
      ctlr.pr.Last_Name__c       = c.LastName;
      ctlr.pr.Email_Address__c     = c.Email;
      ctlr.ClinicId           = a.Id;
      ctlr.pr.Clinic_Phone_Number__c   = '416 555 5555';
      ctlr.pr.Title__c         = 'Tester';
      ctlr.lang             = 'en_US';
      ctlr.pr.Email_Opt_In__c     = true;
      ctlr.createRequest();

    Portal_Request__c pr         = [select Id, Status__c, Clinic__c from Portal_Request__c where Id = :ctlr.pr.Id];
      //System.assertEquals(pr.Status__c, 'Approved');
      System.assertEquals(pr.Clinic__c, a.Id);
      System.assertNotEquals(pr.Status__c, 'Approved');

    List<User> uList           = [select Id from User where Email = :c.Email];
    System.assertEquals(uList.size(), 0);

    List<Account> searchList       = portalRequestController.lookupAccount('Account');
    System.assertEquals(searchList.size(), 0);
    }}

I have highlighted error 
I have visualforce page on Community portal to create child case for followup. When they create child case, visualforce page shows Description of Parent Case automatically. We want to make description field as blank by default. Below is piece of code. I am not sure if below code is relevant, please let me know if not. 

<div class="form-group">
                                <label for="description" class="control-label">
                                   {!$Label.Portal_Case_Summary_Questions} *
                                </label>
                                <apex:inputField value="{!thisCase.Description}" label="" styleClass="form-control" id="description" />
                            </div>
                        </div>
 
I have a requirement of updating a record of PMR Object every Thursday at 4PM. Changing Field value to Shipped. How can this be done. PMR record is getting created at any day or time so i can't use time based Workflow. Any Thoughts please.  

Little history around this.WIth third party tool, report is  scheduled every thursday and xls is posted to vendor's FTP site. Report has couple of filters. What we want to do is to update record posted in FTP site as "shipped". 

Hi Guys, 

I am having a problem with Auto Approval process when case is created from Customer Community. This process was designed few years ago and working fine until last week. Suddently Auto approval functionality not working. 

Below is from debug log 

11:06:36.0 (789572586)|WF_RULE_FILTER|[Case : Case Record Type equals Vet Refusal, Complaint] AND
 ([Case : Case Origin equals Veterinary Portal] OR
 ([Case : Case Origin equals Web form] AND
 [Account : Account Record Type equals Veterinarian, Veterinarian School]))
11:06:36.0 (789599544)|WF_RULE_EVAL_VALUE|01250000000Qn2F
11:06:36.0 (790013307)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790025657)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790038537)|WF_RULE_EVAL_VALUE|0121T000000ARoR
11:06:36.0 (790050307)|WF_EVAL_ENTRY_CRITERIA|Palatability Refusals Process|00X50000001a8hG|false
11:06:36.0 (790087611)|WF_PROCESS_FOUND||No applicable approval process was found.
11:06:36.0 (790841041)|CODE_UNIT_FINISHED|Workflow:ApprovalProcessActions
11:06:36.0 (790980116)|DML_END|[251]
11:06:36.0 (791029629)|EXCEPTION_THROWN|[251]|System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
11:06:36.0 (791458699)|HEAP_ALLOCATE|[251]|Bytes:127
11:06:36.0 (791511759)|VARIABLE_SCOPE_BEGIN|[257]|e|System.DmlException|true|false
11:06:36.0 (791603768)|VARIABLE_ASSIGNMENT|[257]|e|"common.apex.runtime.impl.DmlExecutionException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []"|0x30f3a637

(791710185)|USER_DEBUG|[258]|DEBUG|PalatabilityRefusal_NewCaseController: Exception while submitting for approval: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
below is from Controller page

 
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Auto-Submitted by controller for Approval.');
        req1.setObjectId(thisCase.id);
        
        System.debug('PalatabilityRefusal_NewCaseController:  Process Approval Request: '+ req1);
        Approval.ProcessResult result;
        try{
            result = Approval.process(req1);
            if (!result.isSuccess()){
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'An Error Occurred when submitting the request.  Please contact your administrator.'));
                return (null);
            }
            System.debug('PalatabilityRefusal_NewCaseController: Successfully submitted for approval.');
        }catch(System.DMLException e){
            System.debug('PalatabilityRefusal_NewCaseController: Exception while submitting for approval: '+e);
            System.debug('PalatabilityRefusal_NewCaseController: Exception trace: '+e.getStackTraceString());
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLId(0));
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLFields(0));
            System.debug(thisCase);
            hasErrors = true;
            ApexPages.addMessages(e);
            return (null);
        }
W

We used to receive message in Approval Process Comments that "Auto-Submitted by controller for Approval." but right now we have to manually submit it. It's working fine in manual Approval. 

Somehow it stopped working through Controller. Let me know if you need more details to understand it better. 

What do you suggest. 

Thanks in advance. 
I have visualforce page on Community portal to create child case for followup. When they create child case, visualforce page shows Description of Parent Case automatically. We want to make description field as blank by default. Below is piece of code. I am not sure if below code is relevant, please let me know if not. 

<div class="form-group">
                                <label for="description" class="control-label">
                                   {!$Label.Portal_Case_Summary_Questions} *
                                </label>
                                <apex:inputField value="{!thisCase.Description}" label="" styleClass="form-control" id="description" />
                            </div>
                        </div>