Account


Earned badges

Achievement: Latest Unlocked

Topic Started

This user has not created any forum posts.

Replies Created

Reply to: Salesforce Test Class Error

0 votes

Hi Duo,

This is the code for a test class, we are simply trying to create a transaction record and we are again getting the error " Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You need to open the record before you can edit it." on the "insert testPackage".

        Test.startTest();
        Deal_State__c testDealState = new Deal_State__c();
        testDealState.Docusign_Envelope_Status__c = 'Sent';
        insert testDealState;
        
        ESL__Package__c testPackage = new ESL__Package__c();
        testPackage.Name = 'Test Package';
        testPackage.Deal_State__c = testDealState.Id;
        testPackage.ESL__Status__c = 'Sent';
        insert testPackage;
        Test.stopTest();


Reply to: Salesforce Test Class Error

0 votes

Hi Duo

Thank you for the response the trick solved the insert issue.
Also, for an apex code test class which delete the package from the onespan but keep its salesforce record and then changes the status of the transaction in salesforce, I am getting a script exception as below. Can you please help me with this ?

EXCEPTION_THROWN [36]|System.DmlException: Update failed. First exception on row 0 with id aBeDE000000qt8d0AA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ESL.PackageTrigger: execution of BeforeUpdate


Subscriptions

Topics Replies Freshness Views Users

We are working on creating Onespan transactions in Salesforce and have written out some Apex Trigger code to assist with the process.

7 2 months 2 weeks ago 265
Profile picture for user Duo_Liang

Code Share

This user has not submitted any code shares.

Subscriptions Release Notes

This user is not subscribed to any release notes.