• Nayana Pawar
  • NEWBIE
  • 55 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
Hi Team,

I am updating a Opportunity record field from another filed from a custom object, when i update custom field from the custom object am getting FIELD_FILTER_VALIDATION_EXCEPTION error in custom object.

This is the error message that i am getting when i update the custom object record.

Error Message : 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger PrimeBaseRate caused an unexpected exception, contact your administrator: PrimeBaseRate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 1 with id 006g00000095GZsAAM; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [Existing_Lender__c]: Trigger.PrimeBaseRate: line 26, column 1

Here, the trigger we are using,
 
trigger PrimeBaseRate on Prime_Rate__c (after update, after insert) {

Static Double x;

for(Prime_Rate__c  pr : trigger.new){

x= pr.Prime_Base_Rate__c;

}
System.debug('the vaulue of field is '+x);

//created a new list for bulkifying
list<opportunity> op = new list <opportunity>();

//running for loop for entire table. 
for(opportunity op1 : [select id, Base_Rate__c from opportunity where isclosed=false]){

//changing the value of the field with the static variable. 
op1.Base_Rate__c=x;
op.add(op1);

} 
update op;
}

Can any one modify this code and help me?

Thanks & Regards,
Karthikeyan Chandran
+91-9944676540
 
Hello,

I want to reimplement new button, which will do same fucntion as new and some additional things.
If someone could suggest how to reimplement new utton whihc will do same as the new before, i can do the rest part.

Thank you.
  • July 24, 2015
  • Like
  • 0
When I tried to do this with <apex:include> I got the following error: 
" Error: 'apex:form' component cannot be nested within form tags " 
If I remove form tag from that page,it contains lots of components that can not survive without form.
For instance if I delete the form tag then it is showing the error like 
" Error: <apex:commandButton > (under <apex:page>) must occur between <apex:form></apex:form> tags. "

Can anyone please help me for this.
I have batch class which fetch data from API url into salesforce. Our other team which is working on API from other side they need to set security so that only our saleforce login can access their API. How can we achieve this? can anyone please help us to do this.
Hi All,
I want to do XML Parsing into apex. Please help me to do parsing in apex.
<Orders>
    <OrderID>3401</OrderID>
    <AddressValidated>Y</AddressValidated>

    <OrderDetails>
        <OrderDetailID>2584</OrderDetailID>
        <GiftWrapCost>0.0000</GiftWrapCost>
        <GiftWrapNote/>
        <ProductCode>800006</ProductCode>
        
    </OrderDetails>
</Orders>
I'm very new to this and managed to write a trigger, preventing a duplicates on a custom object 'Time Estimating' and giving a customised error on screen.  Code is below.

The trigger works perfectly in Sandbox but I can't move the trigger into production as it doesn't include tests.  So I have written a separate apex class to test.  The code is also below.  When I debug I get the following error 'required (...)+ loop did not match anything at input '<EOF>'.  I have googled this to death with no helpful result. When I run tests I get 0% code coverage for the trigger.

Can anyone advise what I have done wrong?  

I'm using the Developer Console (can't install anything else).

Apex Trigger to check for duplicates (called PreventDuplicate)
trigger PreventDuplicate on Time_Estimating__c (before insert, before update){
 
    List<String> uniqueValueList = new List<String>();
    for(Time_Estimating__c a : Trigger.new){
        uniqueValueList.add(a.Unique_Year_Estimate__c);
    }

    List<Time_Estimating__c> acctList = [select id, name, Unique_Year_Estimate__c from Time_Estimating__c where Unique_Year_Estimate__c IN :uniqueValueList];
    Map<String,Time_Estimating__c> uniqueValueMap = new Map<String,Time_Estimating__c>();
    for(Time_Estimating__c a : acctList){
        uniqueValueMap.put(a.Unique_Year_Estimate__c,a);       
    }
 
    for(Time_Estimating__c a : Trigger.new){
        if(uniqueValueMap.containsKey(a.Unique_Year_Estimate__c)){
           
            if(trigger.isInsert || (trigger.isUpdate && a.id<>uniqueValueMap.get(a.Unique_Year_Estimate__c).id)){
                a.addError('A Time Estimate for the year you have specified already exists.  Please click the cancel button and update the existing time estimate.');
            }          
        }
    }
}

Apex class to test trigger (called PreventDuplicateTest)
@isTest

//test for PreventDuplicate trigger on Time Estimating
Public Class PreventDuplicateTest
{
   Static testMethod Void PreventDuplicate()
   {
      Boolean result = false;
      Time_Estimating__c firstAcc = new 
          Time_Estimating__c(Unique_Year_Estimate__c = 'test - 2015',Matter_Name__c = 'test');
      insert firstAcc;
      try{
           Time_Estimating__c secondAcc = new 
               Time_Estimating__c(Unique_Year_Estimate__c = 'test - 2015',Matter_Name__c = 'test');
           insert secondAcc;
       }catch(DmlException ex){ result = true;}
      System.assert(result);
   }
}

Many thanks for your help!
Hi EveryOne,
Are there any certain things where we will not be allowed to use @Future methods such as test classes,schedulable classes or some complex triggers and any situations that will not allow us to use @future method?  
Hi Team,

I am updating a Opportunity record field from another filed from a custom object, when i update custom field from the custom object am getting FIELD_FILTER_VALIDATION_EXCEPTION error in custom object.

This is the error message that i am getting when i update the custom object record.

Error Message : 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger PrimeBaseRate caused an unexpected exception, contact your administrator: PrimeBaseRate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 1 with id 006g00000095GZsAAM; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [Existing_Lender__c]: Trigger.PrimeBaseRate: line 26, column 1

Here, the trigger we are using,
 
trigger PrimeBaseRate on Prime_Rate__c (after update, after insert) {

Static Double x;

for(Prime_Rate__c  pr : trigger.new){

x= pr.Prime_Base_Rate__c;

}
System.debug('the vaulue of field is '+x);

//created a new list for bulkifying
list<opportunity> op = new list <opportunity>();

//running for loop for entire table. 
for(opportunity op1 : [select id, Base_Rate__c from opportunity where isclosed=false]){

//changing the value of the field with the static variable. 
op1.Base_Rate__c=x;
op.add(op1);

} 
update op;
}

Can any one modify this code and help me?

Thanks & Regards,
Karthikeyan Chandran
+91-9944676540
 
I want to call a method which has a id as parameter. i want to call that method in constructor. how to do it ?
Hello,

I want to reimplement new button, which will do same fucntion as new and some additional things.
If someone could suggest how to reimplement new utton whihc will do same as the new before, i can do the rest part.

Thank you.
  • July 24, 2015
  • Like
  • 0