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

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?
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?
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)