Skip to main content

#Record Id Value0 debatiendo

Hi everyone,

 

I've having trouble in testing my Record-Triggered flow using the Tests feature, that I cannot overcome.

 

In summary, when I run with the Debug, everything is fine, and flow runs until the end.

However, when I run with a Test (either a Test converted from the Debug run, or a new Test created from scratch), it won't run the same way, i.e., it will fail, as it cannot find records related to the $Record that triggered the flow.

 

I've noticed that the Record ID is not the same between the Debug and the Test. In fact, the Record ID,

 from test does not exists. I don't understand why running a Test is making up an inexistent record ID.

 

Please find below is the interview starting info with the correct (existing) Record Id for the Debug run.Flow different behavior between debug and test

 

Below is the interview starting info with the incorrect (non existing) Record Id for the Test run.

(actually, each time I run the Test, it makes up a new Record ID)Record ID from Test.png

 

Has anyone already add this problem ? Is this a bug or is there something I'm missing? Is there a workaround?

 

Thanks in advance

 

#Flow  #Record-Triggered  #Record Id Value  #UI Validation Tests  #Test Case Management

1 respuesta
  1. Davis Johnson (SolomonEdwards) Forum Ambassador
    26 feb 2024, 16:25

    @Tiago Simao,

    Flow tests take a copy of the triggering record as the record they operate on. And (similar to Apex tests), the record is never actually committed to the database, it exists solely as on-demand test data. Here is an article that sums up that functionality: https://help.salesforce.com/s/articleView?id=sf.flow_concepts_testing.htm&type=5

    What exactly is the problem you are running into, though?

0/9000

Hi,

 

I have an X-Author presto app that is launched from Salesforce. The goal is to query the record and display the data fields from a single Salesforce record, then run a macro and produce a PDF that is then attached to the Salesforce record.

 

Everything is working when I use a static record id value in the Query. How can I pull in the record id based on which record is leveraging the button? Am I able to pass it into the button as a parameter that can be leveraged?

 

Thanks!

1 comentario
  1. 22 ene 2023, 15:32

    One way to do this is to create a custom button on the Salesforce object that launches the X-Author presto app and pass the record ID as a parameter. You can use the {!URLFOR($Action.ObjectName.ButtonName, Id)} merge field to pass the record ID as a parameter in the URL of the custom button.

0/9000