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 

Adding a LEFT to ApexPages.currentPage().getParameters().get('oppId');

I have a visualforce page and controller, part us which grabs "oppid" from the url and inserts it as part of the record.

a.Opportunity__c = ApexPages.currentPage().getParameters().get('oppId');
This works fine, if I have a URL such as:
salesforce.com/oppid=000013456789123

But sometimes, I get a URL such as:
salesforce.com/oppid=000013456789123?srPos=0

I would like to strip off everything after oppid=(first 15 chars). I was thinking about using something like LEFT,15 to do it. I have yet to get the formating right. Any suggestions?
Abhinav GuptaAbhinav Gupta
Not sure how this is happening by normal salesforce generated urls, you could try substring in apex i.e. 
if (oppId != null && oppId.length() > 15) {
            oppId = oppId.substring(0, 15);
        }