Skip to main content

#Analytics34 diskutieren mit

1 Antwort
  1. 21. Sept., 20:47

    Hi Suraj,

    To write a unit test for a @future (callout=true) method, you need to mock the HTTP callout (using HttpCalloutMock) and enclose the execution between Test.startTest() and Test.stopTest(). Salesforce runs all asynchronous methods (like future methods) called within startTest() and stopTest() synchronously right when Test.stopTest() executes. 

     

    Here is an example test class structure to cover your method:

    1.Create a Mock Callout Class:

    Mock Implementation. 

    Create a mock class that implements HttpCalloutMock to return a fake JSON response simulating your patchCall output (ensuring it contains 'state' => 'Success' and a valid JSON structure with an id field).

    2.Prepare Test Data and Context:

    Test Setup. 

    In your test method, insert a test Bid_Review_Request__c record so that the update brUpdate; statement can successfully find and update a record in the database.

    3.Wrap in Start/Stop Test:

    Execution and Assertion. 

    Assign your mock, wrap the future method call inside Test.startTest() and Test.stopTest(), and assert that the record was updated successfully.

    Apex 

     

    @isTest

    private class NewProjectHandlerTopUpTest {

    // 1. Mock class for HTTP callouts

    public class MockHttpResponseGenerator implements HttpCalloutMock {

    public HTTPResponse respond(HTTPRequest req) {

    HttpResponse res = new HttpResponse();

    res.setHeader('Content-Type', 'application/json');

    res.setStatusCode(200);

    // Construct JSON response matching the parser requirements

    res.setBody('{"state": "Success", "resBody": "{\\"id\\": \\"12345\\"}"}');

    return res;

    }

    }

    @isTest

    static void testNewProjectHandlerTopUp() {

    // Create test record to satisfy update operation

    Bid_Review_Request__c testReq = new Bid_Review_Request__c(

    Name = 'Test Project'

    // Add required fields for Bid_Review_Request__c here

    );

    insert testReq;

    Map<String, String> recordMap = new Map<String, String>{

    'ID' => testReq.Id,

    'Name' => 'Test Project'

    };

    // Set mock callout

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

    Test.startTest();

    // Calling the future method

    YourClassName.newProjectHandlerTopUp(recordMap, '{"test":"json"}', 'destination', 'WBS123');

    Test.stopTest(); // Future method executes here

    // Assertions to verify the record was updated

    Bid_Review_Request__c updatedReq = [SELECT WBS_Project__c FROM Bid_Review_Request__c WHERE Id = :testReq.Id];

    System.assertEquals('12345', updatedReq.WBS_Project__c, 'The WBS Project code should be updated successfully.');

    }

    }

    (Note: Replace YourClassName with the actual name of the Apex class containing your future method).

0/9000

I saw this in the Ohana Slack Group. Is there any truth to this, I certainly hope not? 

 

 

CRMA End of Life?

 

 

22 Antworten
  1. 22. Mai 2025, 17:01

    Salesforce has not and is not considering to set CRM Analytics to End-of-Life.

    Yes, there are rumors in the market - they are simply wrong.

0/9000

I am trying to disable by using autocomplete="Off" but its now working can anyone help with this i am using this under lightning record edit form

 

#Sales Cloud  #Service Cloud  #Marketing Cloud  #Analytics  #Nonprofit  #Trailhead  #New Releases  #Integration  #AppExchange

1 Antwort
  1. 20. Sept., 06:57

    Hi Vikrant, autocomplete="off" isn't supported directly by lightning-input-field because it doesn't expose the underlying <input> element's autocomplete attribute. 

    If you need to control autocomplete, you can use lightning-input instead of lightning-input-field and set: 

    <lightning-input

    type="text"

    autocomplete="off"

    name="myField">

    </lightning-input>

      

    If you need to keep lightning-record-edit-form and lightning-input-field, you generally can't reliably disable the browser's autocomplete through the component attribute. 

      

    If you can share which field you're trying to disable autocomplete for and what browser you're testing in, I can suggest a more specific workaround. 

     

0/9000

I need to create a formula field that updates a checkbox after verifying Company's value. I couldn't complete creating a formula field as it throws an error that the limit is 5000 characters. I want to query many company values and update the checkbox. Can someone please suggest an alternative to achieve this functionality?

 

Can I create a trigger or apex class? 

 

#Sales Cloud #Analytics #Automation #Integration Would creating that be affected by character limits as well?

1 Antwort
  1. 17. Sept., 14:07

    Hi SidParnam,

    If you're maintaining a long list of company names in a formula, I wouldn't recommend moving the same large IF/OR logic into Apex. Apex doesn't have the formula field's 5,000-character limit, but hard-coding a large company list makes the solution difficult to maintain.

    A better approach would be to store the company values as configuration:

    • Create a Custom Metadata Type with the company name and the checkbox value.
    • Use a before-save Record-Triggered Flow to look up the company and set the checkbox.
    • If you need more complex processing or a very large dataset, Apex can also query the configuration and update the record.

    This way, adding or removing a company doesn't require changing and redeploying your formula/Apex code. 

     

    If you share approximately how many company values you have and whether the checkbox needs to update immediately when the Company field changes, we can suggest the simplest implementation. 

0/9000

#Trailhead  #Automation #TrailblazerCommunity #Trailblazers #Analytics

There is a request from an internal team at the organization to send a report extract from Salesforce to a shared network drive within the organization for a bot to pickup. Is there a way to automate this within Salesforce? 

1 Antwort
  1. 17. Sept., 14:05

    Hi Rashi,

    Salesforce doesn't natively write files directly to an organization's shared network drive. A common approach is to use an external integration or middleware between Salesforce and the network location.

    For example:

    1. Schedule a Salesforce report/export or query the required records through the Salesforce API.
    2. Have an integration service retrieve the data on a schedule.
    3. The integration writes the generated CSV/file to the shared network drive for the bot to process.

    Depending on your environment, this could be implemented using MuleSoft, an ETL/integration platform, or a small scheduled service that uses the Salesforce API. 

     

    If the requirement is specifically for a scheduled Salesforce report export, rather than querying the data directly, the available options are different. Sharing the required file format, frequency, and whether middleware is already available would help determine the best approach. 

0/9000

I would like to change a rating from 5-star to 3-star.  I created a picklist titled, "Grade," and the values are 1,2,3.  Then I have a formula field with the following, 

 

IMAGE( CASE(Grade__c, "1", "/img/samples/stars_100.gif", "2", "/img/samples/stars_200.gif", "3", "/img/samples/stars_300.gif", "/img/samples/stars_000.gif"), "WAS Rating")

 

Even though I only selected 1,2,3 for my picklist and 1,2,3 in the formula, the field still shows 5 available stars.  I want this to show 3 available stars.  Please let me know how I can do this.  

 

Thanks, 

Mike

 

#Service Cloud  #Marketing Cloud  #Analytics  #Trailhead  #Automation

1 Antwort
  1. 17. Sept., 14:03

    Hi Michael,

    The issue is that /img/samples/stars_100.gif, stars_200.gif, and stars_300.gif are Salesforce's sample images, and those images are based on the standard 5-star rating scale. Changing the picklist values doesn't change the number of stars in the image itself. 

     

    If you want a true 3-star display, you'll need to use your own 3-star image files as a Static Resource and reference those in the formula.

    For example:

    IMAGE(

    CASE(

    Grade__c,

    "1", "/resource/YourStarResource/star_1.png",

    "2", "/resource/YourStarResource/star_2.png",

    "3", "/resource/YourStarResource/star_3.png",

    "/resource/YourStarResource/star_0.png"

    ),

    "Rating"

    )

    Create the appropriate 0-, 1-, 2-, and 3-star images and upload them as a Static Resource. That way the displayed scale is actually limited to 3 stars. 

0/9000

Hi,  

 

I would like to know if we can embed a External Dashboard into Salesforce. We have a looker dashboard that sources data from multiple places. How do I expose  per account on SFDC or a Wholistic view. Or Should I have recreate all in CRM Analytics?  

 

Thanks In Advance 

@* CRM Analytics (fka Tableau CRM) *

5 Antworten
  1. 7. Sept., 15:29

    I’d probably keep the Looker dashboard if it’s already bringing together data from multiple sources. If the main goal is to give users an account-level view inside Salesforce, I’d first look at whether embedding the existing dashboard can meet that need before rebuilding everything in CRM Analytics.

    I’ve found this approach useful in other projects too. For example, with fit-out work, it often makes more sense to work with what’s already in place and improve the parts that need attention rather than starting everything from scratch.

0/9000

Hi, 

 

I am trying to get some reporting on our form submissions. I have tried the Analytics reports "Form Submission Event" and "Individual with Form Submission", to see how many times (and ideally when and by who) our forms are being filled out. When I try either of these reports, they only return 22 or 24 items, however I know we have had around 300 submissions. There are no filters on that I am adding. I am unsure how I can see this information. 

 

Thanks! 

 

#Analytics  #Marketing Cloud

4 Antworten
  1. 2. Sept., 12:14

    Hi Emily,

    This mismatch usually comes down to one of two things:

    1. Hidden default date filter (most likely cause) — many Data Cloud/Analytics report templates carry an implicit time-range filter (e.g., trailing 7/30 days) that isn't shown as a visible chip. Open the report in edit mode, check the lens/query for a date condition, and widen or remove it.

    2. Ingestion gap — go to Data Cloud > Data Lake Objects > your Form Submission stream > Data Explorer, and check the row count there directly. If it's already ~22-24 at that level, the issue is upstream in ingestion (check the Data Stream's refresh history for a partial/failed run), not in the report.

    Also worth noting: "Individual with Form Submission" counts by resolved Individual, not raw event — so if your Identity Resolution match rules are broad, some submissions may be consolidating under fewer unified profiles. That's expected for that report specifically, but it wouldn't explain a similar gap on "Form Submission Event," which should be event-level.

    Start with the date filter check — that resolves this in most cases.

0/9000

We are evaluating Agentforce Analytics in Agentforce Studio and would like to understand the licensing requirements. Is a Data Cloud license

required to use Agentforce Analytics, or can it be used with standard Agentforce licenses? If Data Cloud is required, which specific Data Cloud permissions, editions, or features are needed? 

 

#Agentforce  #AgentforceBuilder  #Analytics

3 Antworten
  1. 19. Aug., 09:19

    It would be helpful to know whether standard Agentforce licensing covers the basic analytics features or if Data Cloud is required. 

    A clear breakdown of the required edition, permissions, and specific Data Cloud features would make the licensing decision much easier.

0/9000

Hello, 

I'm currently trying to create a date field in a dataflow to calculate the month end date 6 months prior to another field. For example: 

 

Existing_Date_Field

= 2026-06-30 

Desired_Result

= 2025-12-31 

 

I'm struggling to find a combination of functions that gets me this result. Has anyone tried to do something similar and could you share your SAQL expression?  

 

 

Thanks!

9 Antworten
  1. 5. Aug., 20:40

    Posting a solution incase anyone is trying to solve the same issue in the future. It may not be the most simplified solution, but it does give the correct results: 

     

    month_last_day(toDate(

    (case

    when string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "MM")) <= 6

    then number_to_string(string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "yyyy")) - 1, "0000")

    else number_to_string(string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "yyyy")), "0000")

    end)

    + "-" +

    (case

    when string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "MM")) <= 6

    then number_to_string(string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "MM")) + 6, "00")

    else number_to_string(string_to_number(date_to_string(toDate(Existing_Date_Field_sec_epoch), "MM")) - 6, "00")

    end)

    + "-" + "01",

    "yyyy-MM-dd"))

0/9000