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
anurajanuraj 

FIELD_CUSTOM_VALIDATION_EXCEPTION

Hi

 I am writing a test class for a trigger. But i am not able to run it properly it only contain 68%. 

The error is

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This part is not forecastable. Contact the Marketing Manager for more information, refer to the Parts Lookup report in the TriQuint Pricing Reports folder.: []

 

my code is

@isTest
private class TestTriggers
{
   static testMethod void testService()
   {        
   //Insert part    
    list<Opportunity> Opportunity = new list<Opportunity>();
    Opportunity = [Select id from Opportunity];
    list<Product2> Product = new list<Product2>();
    Product = [Select id from Product2];
    Part__c p = new Part__c(Stage__c = 'idea',Product__c=Product[0].id,Opportunity__c=Opportunity[0].id);
    insert p;
   
   //Update part
    list<part__c> partlist = new list<part__c>();
    partlist =  [Select Stage__c from part__c where Stage__c = 'idea'];
    partlist[0].Stage__c = 'update';
    update partlist;/* */
   }
}

 Thanks

Anuraj

bob_buzzardbob_buzzard

This sounds like you have a validation rule on the Part__c object - I'd check for that in the first instance.