You need to sign in to do that
Don't have an account?

update a field based on another with click of button that pops up
So the request I have is to create a custom button on opportunity that pops a window allowing the user to add a comment
: That comment must be appended with today date and should be added to comment section
Next time another comment is added the previous comment should be added to a description filedSo on so forth
Where comment and description will be read only fields on the page
Comment is Rich text field
i have my apex class
public with sharing class AddCommentbuttonOpportunity { public Opportunity getComments{get;set;} public AddCommentbuttonOpportunity(Apexpages.StandardController controller){ List<String> fields= new List<String> {'Comments_Next_Steps__c'}; controller.addFields(fields); this.getComments=(Opportunity)controller.getRecord(); if(getComments.Comments_Next_Steps__c!=null) { getComments.Comments_Next_Steps__c = System.today() + ' ' + getComments.Comments_Next_Steps__c; string temp= getComments.Description; if(temp==null && String.isBlank(temp)){ getComments.Description= getComments.Comments_Next_Steps__c; }else If(temp!=null && String.isNotBlank(temp)){ getComments.Description= getComments.Comments_Next_Steps__c +'/n' +temp; } } } public PageReference save() { insert getComments; return new PageReference('/'+getComments.id); } } This is my VF page <apex:page sidebar="false" standardController="Opportunity" extensions="AddCommentbuttonOpportunity"> <apex:form > <apex:pageBlock title="Add a New Comment"> <apex:pageBlockSection > <apex:inputfield value="{! Opportunity.Comments_Next_Steps__c}" /> <br/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> but when i enter value and click save i am getting error ' what am i missing
which code are you taking about?
For updates about the tellthebell, please visit: www.tellthebell.com (https://discosw.net/tellthebell-survey/)