You need to sign in to do that
Don't have an account?
Jerome 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
Decision 1:
Formula 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
Decision 2:
Formula 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
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
Decision 1:
Formula 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
Decision 2:
Formula 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
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!!
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!!