Skip to main content

#Apex34 debatiendo

I need to exclude:

  •  Closed Won/Lost 
  •  Unqualified 
  •  Duplicate
  • Pending Acceptance 

opportunities from updating when Account owner changes using standard change owner wizard and retain the old owner of the opportunity record. In trigger I tried to capture before change owners and tried to update after changes with the old owners but the splits are not added with new owner and when my logic runs it throws an error atleast one revenu split must be with owner. How to overcome this as flows and triggers are cascaded by the standard functionality.Thanks!  

 

#Salesforce Developer  #Apex  #Triggers  #Flows  #TrailblazerCommunity  #Salesforce

2 respuestas
  1. 18 jun, 3:59

    @Abhishek R I tried that way it is bypassing flow and triggers.I am trying to use CDC to capture the changed owner not sure will that work.Thanks for the reply.

0/9000
I have two class:

OpportunityLineItemTriggers

OpportunityLineItemTriggers_Test

In the developer console, I run the test class of which there are 5 and all of them check out as green. Yet the code coverage remains very low on the class. When I open up the OpportunityLineItemTriggers class and select Code Coverage, it's only showing that it ran one test, and it's the last one in the list.

Has anyone else run into this problem, and if so, how can I get the Code Coverage to be cumulative across all of the tests in the test class?
2 respuestas
  1. 5 may 2015, 15:16
    No I can't. There are over 1500 lines of code between those classes, and there are other triggers and classes such as Opportunities, Accounts, Contacts which also run. What I'm wondering is why only the last running test is showing up as the one that covers the class when I have 5 test methods. I ran the unit tests again, and each time the Code Coverage showed only one test method running against the class, I commented out that test method and ran the unit tests again. There ended up being two test methods which I had to comment out, and then when I ran the unit tests again, the remaining 3 showed up in the Code Coverage drop down. 

    I'll have to look at the two I commented out to see how they are affecting the other unit tests and why they are not showing up as cumulative.

    Thanks for the reply.
0/9000

Challenge Not yet complete... here's what's wrong: 

At least one unit test from

RewardsCalloutServiceTest has failed during the most recent test run. Make sure to run all unit tests and they all pass. (module: apex callouts)

 

#Trailhead Challenges  #Trailhead  #Salesforce Admin  #Salesforce  #Apex  #Salesforce Developer

2 respuestas
  1. 10 jun, 15:07

    ++ You can try the code below, 

     

    @isTest

    public class RewardsCalloutServiceTest {

    @isTest static void testSubmitUsersForRewardCallout() {

    Test.setMock(HttpCalloutMock.class, new RewardsCalloutServiceMock());

    // Create test data for Wellness Journey

    List<Wellness_Journey__c> journeys = new List<Wellness_Journey__c>();

    User testUser = [SELECT Id, Name, Username, Email FROM User WHERE Id = :UserInfo.getUserId()];

    for (Integer i = 0; i < 12; i++) {

    Wellness_Journey__c journey = new Wellness_Journey__c(

    OwnerId = testUser.Id

    );

    journeys.add(journey);

    }

    insert journeys;

    Test.startTest();

    Database.executeBatch(new WellnessJourneyRewardsBatch());

    Test.stopTest();

    // Assertions to validate the behavior can be added here

    Integer statusCode = RewardsCalloutService.submitUsersForRewardCallout(JSON.serialize(journeys));

    System.assertEquals(200, statusCode, 'The HTTP status code should be 200');

    }

    }

0/9000
I was hoping to find a way to either set up some sort of automatic email should a deployment fail to an org I own, or to set up a scheduled job to query the DeployRequest object and see the status of the last N deployments.

Everything I've found suggests using checkDeployStatus() but for that I need to know the Id of the deployment. I'm more looking for an automated way to be notified when any memeber of my team pushs a deployment that fails. 

I've not seen many posts on the subject since 2014 when I can see if certainly wasn't possible, hoping someone has figured out a way in the past 6 years.

Thanks!
6 respuestas
0/9000
Hi Experts,

Let me know What are the components we can't added to change set ? if we can't added to the changeset then how to move production? please write some componenete with highlight.

Regards,

Chanti
3 respuestas
0/9000

Hi everyone,

 

This is Shakthi. I'm a developer from India. I have 9 months of experience working on Creatio (a low-code CRM platform) and I’m transitioning into Salesforce Development. Here's my Trailblazer account that I've using on Trailhead to learn things. (https://www.salesforce.com/trailblazer/z9n4nxujjb68i4d63b)

 

Progress so far:

- Developer Beginner Trail 

- Build Lightning Web Components Trail

- Core Apex modules (Triggers, Async, Testing, Integration Services) 

- Apex Callouts Superbadge 

- Apex Web Services Superbadge 

 

I’ve also covered basic SLDS. 

 

Currently going through one of Coding With The Force YT playlist for Apex beginners.

 

My questions on the next steps in my transition journey:

 

1. What should I focus on next?

   - More Superbadges?

   - Start preparing for any certifications, if yes which ones are relevant to the industry today for transitioning developers?

   - Or something else?

 

2. Any roadmap suggestions for someone transitioning from another low-code platform into Salesforce Development?

 

Any advice would be really appreciated. Thank you!

 

P.S: I have been using AI to guide myself in learning Salesforce development and in writing this very message. Wanted to mention it right off the bat.

 

Thank you all in advance for all the guidance and support. 

 

#Salesforce Developer  #Certifications  #Trailhead  #Trailblazer  #Apex

0/9000

Hi everyone,

If you are testing your agents locally using Agentforce DX / Vibes and hitting a generic "Something went wrong" error pointing to missing permission sets (like AgentforceServiceAgentBase or EinsteinGPTPromptTemplateUser) during live test execution, check your sub-agents.

The Issue: This often happens due to an unpopulated reference in the agent script under Local Events. The Fix: Look at your Check Events action under your local sub-agent. If the Reference action type is blank, manually select or set it as a Prompt Template. You can right-click the script and run AFDX: Validate This Agent to verify your structure before starting the simulation server again.

Hope this saves some troubleshooting time! 

 

 

#Agentforce #VSCODE #Apex

1 comentario
  1. 31 may, 20:08

    If you’re testing locally with Agentforce DX / Vibes and get a generic “Something went wrong”

    error mentioning missing permission sets like AgentforceServiceAgentBase or EinsteinGPTPromptTemplateUser, don’t only check permissions. 

     

    In some cases, the real issue is an unpopulated reference in the agent script.

    Go to your Local Events sub-agent and check the Check Events action. If the Reference action type is blank, set it to Prompt Template.

     

    Then right-click the agent script and run

    AFDX: Validate This Agent before restarting the simulation server.

0/9000

Hi Everyone,

I am trying to implement WhatsApp messaging through Salesforce Sales Engagement Cadences using WATI API integration, but I am facing issues with Cadence Step Flow execution and variable passing.

Current Architecture:

Contact Record Triggered Flow

→ Add Contact to Cadence

→ Cadence Step Flow

→ Apex Invocable Action

→ Queueable Apex

→ WATI API Callout

My goal:

When a contact reaches a cadence step, I want to automatically send a WhatsApp template message through WATI.

What I have implemented:

  1. Cadence Step Flow
  2. Apex Invocable Method
  3. Queueable Apex with Database.AllowsCallouts
  4. Named Credential for WATI
  5. Formula payload generation in Flow

Current Flow Payload:

959585****|||abd|||{"name":"Rakesh"}

Invocable Apex:

public with sharing class WatiWhatsAppService {

public class Request { @InvocableVariable(required=true) public String rawInput; } @InvocableMethod( label='Send WATI WhatsApp Message' description='Cadence-compatible WhatsApp action.' ) public static void sendWA(List<Request> requests) { List<String> rawInputs = new List<String>(); for(Request req : requests){ if(String.isNotBlank(req.rawInput)){ rawInputs.add(req.rawInput); } } System.enqueueJob(new WatiQueueable(rawInputs)); } 

}

Issue:

  • Cadence Step Flow is not executing automatically
  • Sometimes the flow step does not launch from cadence
  • Input variables like MobilePhone and FirstName were initially blank
  • I fixed variable mapping using input variables
  • Formula payload is now generating correctly
  • Apex action now appears in flow correctly
  • However, cadence screen flow execution itself is inconsistent

Questions:

  1. Does Cadence Step Flow require manual user interaction from Work Queue to execute?
  2. Is Cadence Step Flow suitable for backend API automation like WhatsApp sending?
  3. Has anyone successfully implemented automatic WhatsApp sending from Sales Cadence?
  4. Would Record Triggered Flow + Apex be a better architecture than Cadence Step Flow?
  5. Are there limitations with Invocable Apex inside Cadence Step Flow?

Any guidance or recommended architecture would be very helpful.

Thanks! 

#Salesforce Developer #Apex #Sales Cadences #Flow

3 comentarios
0/9000
Hi, As we all develop apex code in different sandboxes and finally need to move to QA sandbox/any other sandbox. What are the best tools available for code comparison (my current sandbox version against prod/any other sandbox version) before moving code from one sandbox to another to  understand the changes we did? What are the best practices for code comparison? Any ideas on this will be highly appreciated.
3 respuestas
  1. 20 may, 8:42

    VS Code + Git diff is probably the most common approach for Apex code comparison.

    For larger orgs or multiple sandboxes, teams also use org-to-org metadata comparison tools to compare:

    • Apex Classes
    • Triggers
    • Visualforce Pages
    • layouts and other metadata before deployment.

    We used to compare retrieved metadata manually, but recently started using BOFC for quicker sandbox vs production Apex comparisons:

    https://bofc.io/how-to-compare-apex-classes-across-multiple-salesforce-orgs/

    Best practice is definitely keeping Git as the source of truth and validating differences before every deployment. 

0/9000
PFB assignment details.

Create a class named 'Calculator'.

Declare 2 Integer variables num1 and num2, initialize with some random numbers.

Create a method named 'calculate'.

Declare 4 variables add, sub, mul and div inside the method to perform addition, subtraction, multiplication and division of num1 and num2 respectively.

Display the results of each calculation using 'System.debug' statements in log
2 respuestas
0/9000