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
Jerry ClifftJerry Clifft 

Controller with IF statement for variable text input

I have a controller on a visualpage, this controller has a few "hidden" fields that submit. I need to capture another "hidden" field where the value varies according to kewords in the URL.

Here is my controller:

public PageReference createSFLCase(){
     if(SFLC.Contact_Name__c==null){error='Error: Please Enter Contact Name'; return null;}
     if(SFLC.Contact_Phone__c==null){error='Error: Please Enter Contact Phone'; return null;}
     SFLC.Status='Form Submitted';
     SFLC.Origin='Salesforce Lite';
     SFLC.RecordTypeId='0126000000017LQ';
     SFLC.Bulk_Load__c=True;
     SFLC.Accepted_Term__c = IF($CurrentPage.parameters.type='Service Call',SFLC.Accepted_Term__c = 'Term 1',SFLC.Accepted_Term__c = 'Term 1');
    
Needless to say, that line causes an error. How do I correctly write this line?
Edwin VijayEdwin Vijay
As far as  i know you cannot use the binding symbol $ in your apex class.

Replace $CurrentPage.parameters.type with ApexPages.currentPage().getParameters().get('type') and see if it works.

For Apex Code samples, visit http://www.forcetree.com (http://www.forcetree.com" target="_blank)