function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jerome Almejas 33Jerome Almejas 33 

Help me create a test class for a record triggered flow.

I am new in creating test class for Flow. Please help me create a test class for my record triggered flow.
Process: There should be a contact and a contact should have a Machine Registration object (lookup to Contact) and Machine Registration Object has a Master-Detail relationship with Warranty Object.

Object: Warranty
A record is created
Formula Evaluates to True (New)
      {!$User.CSS_Disableworkflows__c} = false
Fast Field Updates
User-added image

 Decision 1:
User-added imageFormula Resource:
Boolean
Warrantytypeandnowarrantyalready Formula:
AND(
$User.CSS_Disableworkflows__c = false,
OR(
{!$Record.CSS_WarrantyType__r.CSS_WarrantyCode__c} ={!$Label.CSS_ThirdPartyWarranty},
{!$Record.CSS_WarrantyType__r.CSS_WarrantyCode__c} ={!$Label.CSS_ExchangeWarranty}, 
AND(
{!$Record.CSS_WarrantyType__r.CSS_WarrantyCode__c} ={!$Label.CSS_GoodwillWarranty},
(ISBLANK({!$Record.CSS_MachineRegistration__r.CSS_WarrantyEndDate__c} ) ) 
)
)
)

Decision 1 => Update Record
User-added image
Decision 2:
User-added imageFormula Resource:
Boolean
WarrantytypeandWarrantylalreadypresentcheck Formula:
AND(
$User.CSS_Disableworkflows__c = false,
AND(
{!$Record.CSS_WarrantyType__r.CSS_WarrantyCode__c} ={!$Label.CSS_GoodwillWarranty},
NOT(ISBLANK({!$Record.CSS_MachineRegistration__r.CSS_WarrantyEndDate__c} ) ) 
)
)

Decision 2 => Update Record
CSS_StartDate_C = Machine_Registration_r.Warranty_EndDate_c
User-added image
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jerome,

There is no need to create test class for the flow. You can deploy.

If any apex class referred in the flow then you need to write a test class.

If this helps, Please mark it as best answer.

Thanks!!
Jerome Almejas 33Jerome Almejas 33
Ankaiah, it is needed by my client to create a Test Class. Can you help me create a test class for this flow?
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jerome,

Refer the below link have similar kind of ask and modify the test data as per your flow.

https://www.sfdcstop.com/2022/05/how-to-create-test-class-for-flow-test.html

If this information helps, Please mark it as best answer.

Thanks!!