You need to sign in to do that
Don't have an account?

Lightning Flow before save to update name field of opportunity, failing test classes
I am using Flow before save to update name field of opportunity and its causing my test classes fail FATAL_ERROR System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
Test class flow works the same as the data is being created from the UI i.e. page-layouts.
Please refer Order of execution (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm) for better understanding. The data created checks for the Standard Validation like - manadatory fields on page layout, field length etc. and then proceed for before save update flow and then before trigger and custom validation rules and so on..
All Answers
Test class flow works the same as the data is being created from the UI i.e. page-layouts.
Please refer Order of execution (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm) for better understanding. The data created checks for the Standard Validation like - manadatory fields on page layout, field length etc. and then proceed for before save update flow and then before trigger and custom validation rules and so on..
Example:
IF(ISBLANK({!$Record.npsp__Primary_Contact__c}),
'Scholar' + ' ' + TEXT({!$Record.Reason__c}),
{!Get_Contact.Name} + ' '+ TEXT({!$Record.Reason__c}) + ' Year '+ TEXT({!Get_Contact.Stipend_Year__c})
)