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
Joy_JacquesJoy_Jacques 

Parameter value passing literal text, not value

I created a report that is filtered by userid. Then I created a custom link and put in this code.

 

/00OA0000004qgMd?pv1={!$User.Id}

 

When I test the custom link, the criteria in the report will just show userid equals {!$User.Id}, just the formula text, instead of showing userid equals John Smith. It is passing my parameter value as a string literal, not the value. If I substitute an actual userid the report runs correctly, but when I use the code above it puts {!$User.Id} into the filter.

 

Can someone hlep me figure out what I'm doing wrong?

 

Thanks!

GlynAGlynA

Define your custom link so that the behavior is "Execute JavaScript", and use this code:

navigateToURL( '/00OA0000004qgMd?pv1={!$User.Id}' );

Ordinary links can't use merge fields (as you were trying to do), so you have to use a VisualForce page (not appropriate for your use case) or JavaScript.

 

If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!

 

-Glyn Anderson
Certified Salesforce Developer | Certified Salesforce Administrator

Joy_JacquesJoy_Jacques

So I set the behavior to "Execute Javascript" with the Content Source of "OnClick Javascript," and for the value I put:

 

navigateToURL( '/00OA0000004qgMd?pv1={!$User.Id}' );

 

but when I click the link I get:

 

The page at [my domain] says:

 

A problem with the onclick javascript for this button or link was encountered:

navigateToUrl is not defined

Joy_JacquesJoy_Jacques

I think I figured this out. I was trying to do on the Home page. I just found this in the in the support documentation

The standard home page’s Custom Links component doesn’t support

  • Merge fields
  • Functions, such as URLFOR
  • JavaScript execution
  • Customizable window opening properties

 

I tried it from a test buttom on the Contact page and it worked, so it looks like the problem is with where I'm using the merge field. 

GlynAGlynA

Glad you got it to work.  Let me know if you need any more help with it.

 

-Glyn