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
Krista KellyKrista Kelly 

Pop-Up when Quote Expiry Date is in the past

Hi all, 

I am creating a Visual Force page (added to layout) to show a pop-up with the CPQ Quote object loads but it's not actually doing anything. I only dabble in development so any advice is appreciated! Thank you! Here is the VF.

<apex:page StandardController="SBQQ__Quote__c">
<script> window.document.onload = new function(e)
{ if(!SBQQ__Quote__c.SBQQ__ExpirationDate__c < TODAY())
{ alert("Expiry Date is in the Past"); }
}
</script>
</apex:page>

As I cannot capture the "Submit or Approval" click without creating a custom button (as far as I can tell) and already have a Validation rule for when they edit the page this was a solution for any Quotes they do NOT edit before hitting "Submit for Approval".
Alain CabonAlain Cabon
You just need some brackets:
<apex:page StandardController="SBQQ__Quote__c">
 <script> window.onload = function(){ 
  if({!SBQQ__Quote__c.SBQQ__ExpirationDate__c < TODAY()}) { 
     alert("Expiry Date is in the Past"); }
  }
 </script>
 <apex:outputField value="{!SBQQ__Quote__c.SBQQ__ExpirationDate__c}"/>
</apex:page>
My test :
<apex:page StandardController="Test_Obj__c">
 <script> 
   window.onload = function() {
      alert('my test');   
      if({!Test_Obj__c.Expiry_Date__c < TODAY()}) { 
          alert("Expiry Date is in the Past"); 
      }
  }
 </script>
 <apex:outputField value="{!Test_Obj__c.Expiry_Date__c}"/>
</apex:page>