+ Start a Discussion
BrandiTBrandiT 

Custom report link to dynamically filter report based on lookup field>?

I know that I can create a custom link or button on accounts for example that will pass the account id to a report.

 

ex.  button link would be something like :  /00O80000003PXuG?pv0={!Account.Id}

 

I have a custom object with a lookup field to accounts.  Is there a way to build this same type of functionality to pass the account id chosen in the lookup field to the report?  I don't want to pass the custom object id, but the id of a lookup object.  Can that be done?

Best Answer chosen by Admin (Salesforce Developers) 
Ispita_NavatarIspita_Navatar

The custom button link needs to be modified a bit as per your requirement see the attached link for reference:-

 

ex. button link would be something like : /00O80000003PXuG?pv0={!CustomObjectName__c.AccountIdLookup__c}
where : -

 

1 . CustomObjectName__c - is the custom object Name
2 . AccountIdLookup__c - is the custom field in the custom object which is lookup to the account.

 

So in order to implement it you need to create a new custom link specifically for your Custom Object Layout and then it will work.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

All Answers

Ispita_NavatarIspita_Navatar

The custom button link needs to be modified a bit as per your requirement see the attached link for reference:-

 

ex. button link would be something like : /00O80000003PXuG?pv0={!CustomObjectName__c.AccountIdLookup__c}
where : -

 

1 . CustomObjectName__c - is the custom object Name
2 . AccountIdLookup__c - is the custom field in the custom object which is lookup to the account.

 

So in order to implement it you need to create a new custom link specifically for your Custom Object Layout and then it will work.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

This was selected as the best answer
ShellBlack.comShellBlack.com

Here is a step-by-step tutorial: http://www.shellblack.com/salesforce/deploy/custom-report-links/

 

Additionally there is a pdf published by Salesforce on Building Custom Report links

 

Enjoy!

 

ShellBlack.com

Glider17Glider17

Hi, thanks for the great post.

 

I have recently got into the new interface of salesforce.com and it looks like the custom link report function has changed somewhat or the syntax has changed.

 

e.g. when we put pv0={user.name} there , after we click the custom link, the criteria in the report will just show   account owner equals (user.name} , just the formula text,  instead of showing  account owner equals John Smith , 

 

Maybe the new interface has an issue with the custom link or the syntax has changed? It does mention in the release notes that the s-controls can be influenced by the new release.

 

Thank you for looking into this for me.

Joy_JacquesJoy_Jacques

e.g. when we put pv0={user.name} there , after we click the custom link, the criteria in the report will just show   account owner equals (user.name} , just the formula text,  instead of showing  account owner equals John Smith

 

I am having a similar problem to Glider17 above. I created a report that is filtered by userid. Then I created a custom link and put in this code.

 

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

 

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!

jbardetjbardet
I'm having trouble passing in a custom formula field's value into the report. When I follow ?pv0={!CustomObjectName__c.CustomObjectField__c} format, I arrive at:
?pv0={!wocst__c.fiffteenId__c}

This gets passed in as plain text into the report field filter, rather than passing through the field value.

Note: I created this "fifteenId" field to convert the 18 digit ID to 15 digit. When I was using wocst__c.Id, it would the value properly, but as an 18 digit that the report did not recognize.

plain text, not field value