Skip to main content Unisciti a noi al TDX, a San Francisco o su Salesforce+, il 5-6 marzo per la conferenza degli sviluppatori sull'era degli Agenti IA. Registrati ora.

#Trailhead Challenges2.398 utenti parlano di questo argomento

Hands-on challenges are the “secret sauce” of Trailhead. Before searching for solutions to superbadge challenges, review the Salesforce Certification Program Agreement and Policies.

Hello team,

 

You may be able to help me on this challenge:

 

Background:

I want to use the Salesforce Industries 'Batch Management' feature. This feature allows user to run Batch jobs without the need of APEX. Batch Management jobs are trigger via an scheduled flow.

 

Need:

I want to be able to trigger the Batch Job manually at any time.

 

Question:

Is there a way to trigger Batch Management Job manually?

 

I am open for suggestions and ideas.

 

Thank you very much in advance.

1 risposta
  1. 26 apr 2024, 11:09
    Since Batch Management jobs are triggered by a flow - can you run the flow in debug mode to manually trigger the batch process?
0/9000

The 'LeadProcessor' class did not achieve 100% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge.

 

Facing the above error, have tried multiple codes

 

#Trailhead Challenges

17 risposte
  1. 2 lug 2024, 18:19

    Hi @Ankit Bisht,

     

    Thanks for provided the org access. The test is failed due to an active validation rule on Lead object. I have deactivated it and ran the Lead Processor test again and test coverage 100% completed and the challenge check is working as expected.

     

    Hi , Thanks for provided the org access. The test is failed due to an active validation rule on Lead object.

     

    May I request you to please check the challenge and hopefully it works now.

     

    Please feel free to mark my answer as best answer so that can be helpful for other Trailblazers over the community.

     

    Best Regards,

    Ravindra

0/9000

The 'LeadProcessor' class did not achieve 100% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge.

 @Ankit Bisht and @Eric Burté - seems like you guys fixed this issue few months back. Could you please help?

#Trailhead Challenges

5 risposte
  1. Divya Chauhan (Kcloud Technologies) Forum Ambassador
    28 nov 2024, 05:22

    Hello@Ananth Muralidharan,

    Please try,

    make sure you have saved the code

    public class LeadProcessor implements Database.Batchable<sObject> {

    public Database.QueryLocator start(Database.BatchableContext bc) {

    // collect the batches of records or objects to be passed to execute

    return Database.getQueryLocator([Select LeadSource From Lead ]);

    }

    public void execute(Database.BatchableContext bc, List<Lead> leads){

    // process each batch of records

    for (Lead Lead : leads) {

    lead.LeadSource = 'Dreamforce';

    }

    update leads;

    }

    public void finish(Database.BatchableContext bc){

    }

    }

    @isTest

    public class LeadProcessorTest {

    @testSetup

    static void setup() {

    List<Lead> leads = new List<Lead>();

    for(Integer counter=0 ;counter <200;counter++){

    Lead lead = new Lead();

    lead.FirstName ='FirstName';

    lead.LastName ='LastName'+counter;

    lead.Company ='demo'+counter;

    leads.add(lead);

    }

    insert leads;

    }

    @isTest static void test() {

    Test.startTest();

    LeadProcessor leadProcessor = new LeadProcessor();

    Id batchId = Database.executeBatch(leadProcessor);

    Test.stopTest();

    }

    }

0/9000