You need to sign in to do that
Don't have an account?
ArrgHunter
custom field not getting updated
Hi,
i have created custom controller and want to update a custom field with value based on the button user clicked on the vf page.
somehow my field is not being updated. any help will be appreciated as i have spent lot of time on it but unable to fix it.
it will be big help for a charity.
public class IRPTemplateSelection { public IRPTemplateSelection(){ } public PageReference TemplateSelection() { System.currentPageReference().getParameters().get('Templateid'); try { Orphan__c MyOrp = new Orphan__c(); String TemplateId = Apexpages.currentPage().getParameters().get('Templateid'); if (TemplateId != '') {myorp.Biodata_Report_Template_4_Conductor__c = TemplateId;} else {myorp.Biodata_Report_Template_4_Conductor__c = 'a0JP0000001qGwU';} update (myorp); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO'); pageRef.setRedirect(false); return pageRef; } }
<apex:page controller="IRPTemplateSelection" title="Template Selection" id="Templateselectionpage" > <!-- Begin Default Content REMOVE THIS --> <h1>Biodata Template Selection</h1> <apex:form id="allocOrphansForm" > <apex:outputPanel > <apex:pageBlock id="resultsBlock"> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="English BioData Template" action="{!TemplateSelection}" /> <apex:param name="Templateid" value="a0JP0000001qGwU" /> </apex:pageBlockButtons> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="Arabic BioData Template" action="{!TemplateSelection}"/> <apex:param name="Templateid" value="a0JP0000001q86Q" /> </apex:pageBlockButtons> <apex:facet name="header">Choose Template</apex:facet> <apex:outputText value="template"> <apex:param value="test template" /> </apex:outputText> </apex:pageBlock> <apex:pageBlock title="Simple Title"> <b>Hello <i>{!$User.FirstName} {!$User.Country}</i></b> { if {!$User.Country} } </apex:pageBlock> </apex:outputPanel> </apex:form> <!-- End Default Content REMOVE THIS --> </apex:page>
code is as below.
thanks
Code is highlighted in red, enjoy :)
VFP :
Apex :
Thanks
Ankit Arora
Blog | Facebook | Blog Page