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
tbuckettbucket 

Passing Report Criteria through a Custom Button

I have a custom button to a report, and I would like to put a parameter in the formula for the link.

 

Use case: I have a page called Resource, with a child object call Time Logs.  On the Resource detail page, I have a button called "Run Time Log Report".  I would like to point that button to single report, but have it run only for the Resource of the page I am on.

 

Is this possible, or do I have to create a report for each Resource, then use that URL behind the button?

 

Best Answer chosen by Admin (Salesforce Developers) 
IspitaIspita

hi,

Yes its possible what you need to you is a "Parameterized Report" so the filter criterion should be whrere TimeLog.ResourceId equals {keep the value textbox as empty}

Now when you generate the link to  the report like below: -

 /00O60000002nBzz?pv0= {!ResouceId}    --- In blue is the reportid  , in green is the parameter name which is genereally pvn  where n can be 0 to any number depending upon the count/position  of your filter criterion in the report, in red is the API name of merge field for id of resource object of record on whose detail page the link to report is present.

 

Hope this helps....

All Answers

IspitaIspita

hi,

Yes its possible what you need to you is a "Parameterized Report" so the filter criterion should be whrere TimeLog.ResourceId equals {keep the value textbox as empty}

Now when you generate the link to  the report like below: -

 /00O60000002nBzz?pv0= {!ResouceId}    --- In blue is the reportid  , in green is the parameter name which is genereally pvn  where n can be 0 to any number depending upon the count/position  of your filter criterion in the report, in red is the API name of merge field for id of resource object of record on whose detail page the link to report is present.

 

Hope this helps....

This was selected as the best answer
tbuckettbucket

Oh man...thanks so much!  This is going to work great.  I will try out 1st thing in the morning and report back.

tbuckettbucket

Worked beautifully!!  Thanks again!

IspitaIspita

:) Anytime...

nsbnsb

Hi Ispita,

 

I tried this for a Joined Report (Joined Custom Report type and Opportunity with Product Report type) i want to filter the report based upon Account Name.

 

m passing /00O60000002nBzz?pv0= {Account.name}. 

 

When i try the same URL passing using Tabular report, it works.

Any Idea??

 

Thanks