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
AndrewHkAndrewHk 

add Fiscal Quarter picklist field to Opportunities

I am trying to add a date field that would enable my sales team to simply select the fiscal quarter for their Opportunity forecast.  I not particularly concerned about the close date or required delivery date.  

 

Is there any way to create a picklist field that would enable us to select the quarter-year  (eg, Q4 2010) that would correspond to my company-specific fiscal calendar which I have already entered into Salesforce?

 

Thanks in advance for any thoughts you have to offer!

satheeshrsksatheeshrsk

Hi,

 

I'm looking for something similar to this, please share the code if you were achieve this.

 

 

Thanks in advance!

rsk

Sivakumari2iSivakumari2i

Hi,

 

I'm looking for something similar to this, please share the code if you have completed it.

 

Thanks,

S.Sivakumar

satheeshrsksatheeshrsk

Hi SivaKumar,

 

Find the below code, hope it will helps you.

 

Static Resource:
Inclulde the following scripts in Stattic resource


    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>   -------> ABCEdit/jquery-1.8.2.js
    <script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script> ------------>  ABCEdit/jquery-ui.js

   <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />  -------->ABCEdit/jquery-ui.css

VF Page:

<apex:page standardController="ABC__C" id="page" title="Create/Edit ABC" >
<apex:includeScript value="{!URLFOR($Resource.ABCEdit, 'ABCEdit/jquery-1.8.2.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.ABCEdit, 'ABCEdit/jquery-ui.js')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.ABCEdit, 'ABCEdit/jquery-ui.css')}"/>
    <script type="text/javascript">
      
       $(function () {
    $('span[class~="dateOnlyInput"] input').removeAttr('onfocus').datepicker({ beforeShowDay: allowedDates  });    

     });  
      
    var currentYear = new Date().getFullYear();

                                             // enter the fiscaly calender dates here
        var _allowedDates = [
    new Date(currentYear, 2, 31).getTime(),
    new Date(currentYear, 5, 30).getTime(),
    new Date(currentYear, 8, 30).getTime(),
    new Date(currentYear, 11, 31).getTime(),
    ];

    function allowedDates(date) {
        date = date.getTime();

        for (i in _allowedDates)
            if (date == _allowedDates[i])
                return [true, ""];
    
        return [false, ""];
    }
</script>
 <style type="text/css">
    .textSize {
    font-weight: 600;
   
  }
 </style>

<apex:sectionHeader/>
    <apex:pageMessages />   
    <apex:form id="form">
        <apex:pageBlock title="ABC Edit" id="block">
        
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>

            <apex:pageBlockSection title="Information" id="Section1_1">
                <apex:repeat value="{!$ObjectType.ABC__c.FieldSets.EditABC_Information}" var="f" id="repeat">
                    <apex:inputField value="{!ABC__c[f]}" id="field" required="{!f.Required}"/>
                </apex:repeat>
                
                  <apex:inputField id="datepicker" value="{!ABC__c.EffectiveToDate__c}" styleClass="JQueryDate" />
            </apex:pageBlockSection>

  </apex:pageBlock>

</apex:form>

</apex:page>

 

 

Sivakumari2iSivakumari2i

Hey thanks for your reply

 

Its not working.

 

Can you explain me the steps to be followed?Whether i have to create a custom object?If so,What fields it takes and what is the datatype for each field?

 

Regards,

S.Sivakumar.

satheeshrsksatheeshrsk

Its a custom object in my case and custome field of type Date.

 

Thanks!

Sivakumari2iSivakumari2i

I am getting the following error

 

Error: Unknown property 'ABC__c.fieldsets.EditABC_Information'

 

<apex:pageBlockSection title="Information" id="Section1_1">
<apex:repeat value="{!$ObjectType.ABC__c.FieldSets.EditABC_Information}" var="f" id="repeat">
<apex:inputField value="{!ABC__c[f]}" id="field" required="{!f.Required}"/>

</apex:repeat>

 

Can you please explain me?

 

I have created ABC_c Custom object with EffectiveToDate__c as date field. Is there any other process to be completed.

 

Thanks,

S.Sivakumar

satheeshrsksatheeshrsk

Hey, I have overridden standard ABC__c page with VF using  filed sets.  Remove the filed sets part and try only with inputFiled

 

<apex:pageBlockSection title="Information" id="Section1_1">

 <apex:inputField value="{!ABC__c[f]}" id="field" required="{!f.Required}"/>

</apex:pageBlockSection>

 

 

Thanks!

Sivakumari2iSivakumari2i

Thanks for your reply.

It works perfecly