• Zeeshan Moulvi 2
  • NEWBIE
  • 10 Points
  • Member since 2015
  • Senior Technical Analyst
  • Continuserve Soft Tech

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

We are trying to implement a validation on Quote Page by using the below formula. 

IF (Service_Total_Net_Price_c _< 0 and ABSOLUTEVALUE Service_Total_Net_Pricec _ > ABSOLUTEVALUE _Total_Service_Margin_c )

Here is the Trigger which I have created but I'm getting an error while trying to save the trigger, Can anyone please take a look and let me know what is the issue.

trigger CustomQuoteValidation on SBQQ__Quote__c (before insert) {
for (SBQQ__Quote__c a : Trigger.new) {
  if (a.Service_Total_Net_Price__c < 0 && (MATH.ABS(a.Service_Total_Net_Price__c > a.Total_Service_Margin__c ) )) {
    a.addError('Your custom error message');
  }
}
}


Thanks,
Zeeshan.

We have requirement where in we need to display fields based on the checkbox selected .I have written a VF page and Apex classe but still not able to acieve the requirement below are the few points i am trying to achieve.
1. When first checkbox is selected second checkbox should be hidden and viceversa.
2. Also we need to clear the values from the  dependent fields in the pageblock section on unchecked box.

Any lead or steps to achieve this is very hepfull.

Thanks in Advance.
Visualforce Page:


<apex:page standardController="Opportunity" extensions="rpac">

<apex:form >
<apex:pageBlock >
  <apex:pageBlockSection columns="1" id="Test" >
 <apex:inputcheckbox value="{!Opportunity.abc__c}" >
 <apex:actionSupport event="onchange"  action="{!aaa}" rerender="Test" />
</apex:inputcheckbox>
  <!--<apex:outputPanel rendered="{!(Opportunity.abc__c)}" > -->
		<apex:inputField value="{!Opportunity.abc__c}"  rendered="{!(Opportunity.abc__c)}" />
        <apex:inputField value="{!Opportunity.abc_Class__c}" rendered="{!(Opportunity.abc__c)}" />
        <apex:inputField value="{!Opportunity.abc_Transition_Phase__c}" rendered="{!(Opportunity.abc__c)}" />
   </apex:pageBlockSection>
   
   <apex:pageBlockSection columns="1" id="Test1" > 
     <apex:inputcheckbox value="{!Opportunity.xyz__c}" > <!--removed selected=true label="Same as Above" -->
     <apex:actionSupport event="onchange" action="{!bbb}" rerender="Test1" />
     </apex:inputcheckbox>    
        <apex:inputField value="{!Opportunity.ayz_Payment_Terms__c}" rendered="{!(Opportunity.xyz__c)}" />
        <apex:inputField value="{!Opportunity.xyz_Record_Delete__c}" rendered="{!(Opportunity.xyz__c)}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>


Apex class:

public with sharing class Repack{

    public Opportunity test{get;set;}
    public Opportunity test1{get;set;}
    public boolean abc {get;set;}
    public boolean ayz{get;set;}

        public Repack(ApexPages.StandardController stdCtrl) {
        this.test=(Opportunity)stdCtrl.getRecord();
        abc=False;
        this.test1=(Opportunity)stdCtrl.getRecord();
        ayz= False;
        //this.test=true;//observe the change in this line.Added this for proper behaviour on load 
       }
       
       public pagereference aaa(){
           
           return null;
       }
       public pagereference bbb(){
           
           return null;
       }

   }

User-added image