You need to sign in to do that
Don't have an account?
Hari.gs
Customize a date field's edit action
Hi all,
I have to cutomize a date field in Account Object. When a user tries to edit a date field, say Created Date, I need to check whether a value already exists in that filed, if exists I should not save the new value or should not allow the user to edit the field. If the value is empty I should be able to edit it save the new value. Using a trigger I can do this while editing and saving a Account Object. But from UI if a user performs edit how can I perform this check? Please help.
Thanks and Regards
Hari G S
Yes but you cannot do that while using standard account layout. You cannot give any condition for any field in the standard page layout. You can only make that field Read Only through layout. But you can't give any condition there like if it is not null there read only like this. It will become read only for all.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
All Answers
In the client side you can do like that
<apex:page standardController="Account">
<apex:form >
<apex:outputField value="{!Account.TestDate__c}" rendered="{!Account.TestDate__c != NULL}"/>
<apex:inputField value="{!Account.TestDate__c}" rendered="{!Account.TestDate__c == NULL}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Hi thanks for the replay...
So far I have written only triggers in salesforce, I am not sure where to write this piese of code. So could you please help on that also. Please tell me the path where I can put this code try whether this is working as I wanted?
Thanks and Regards
Hari G S
You create a visualforcepage by going to SetUp -> Develop -> New and write there
<apex:page standardController="Account">
<apex:form >
<apex:outputField value="{!Account.TestDate__c}" rendered="{!Account.TestDate__c != NULL}"/>
<apex:inputField value="{!Account.TestDate__c}" rendered="{!Account.TestDate__c == NULL}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>
You can go to Account -> Buttons & Links -> View -> Click the edit beside it and override with the visualforce page you just created.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Hi,
Actualy what I wanted is to disable that calendar popup button for a date field from entering a new date for a date field if a value exists in that fields. If the date field is empty I should be able to select a date from the popup.
Thanks and Regards
Hari G S
Yes but you cannot do that while using standard account layout. You cannot give any condition for any field in the standard page layout. You can only make that field Read Only through layout. But you can't give any condition there like if it is not null there read only like this. It will become read only for all.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks