Hey i am trying to redirect on a url on a click of custom button which will create a new quote in which name will be prepopulate as same as parent opportunity name but it is not redirecting on a page.I have tried this code. {!IF($User.UITheme = 'Theme3' , URLFOR("https://sam-khan-dev-ed.my.salesforce.com/0Q0/e?retURL=Opportunity.Id& oppid=Opportunity.Id&Name=Opportunity.Name") , 'Show error')}

It is showing this error.

Unable to Access Page
The value of the "oppid" parameter contains a character that is not allowed 
or the value exceeds the maximum allowed length. Remove the character from 
the parameter value or reduce the value length and resubmit. If the error 
still persists, report it to our Customer Support team. Provide the URL of 
the page you were requesting as well as any other related information.

You need to use the string concatenation syntax (&). Also be aware of spurious spaces.

{!IF($User.UITheme = 'Theme3',
  URLFOR("/0Q0/e?retURL=%2F" & Opportunity.Id & "&oppid=" 
         &Opportunity.Id&"&Name=" & Opportunity.Name"),
 'Show error')}

Or, even better, use the "params" function of URLFOR:

  URLFOR('/0Q0/e', Opportunity.Id,
     [retURL='/'&Opportunity.Id, oppid=Opportunity.Id, Name=Opportunity.Name]),
  'Show Error')}
  • thanks a lot @sfdcfox it works wonder – Sam1 Sep 23 '19 at 12:32
  • could you please help me with this {!IF($User.UITheme='Theme3', URLFOR('/0Q0/e', Opportunity.Id, [retURL='/'&Opportunity.Id, oppid=Opportunity.Id, Name=Opportunity.Name]), 'URLFOR('/'&apex&'/'&Create_New_Quote)'} – Sam1 Sep 25 '19 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.