+ Start a Discussion
Kerby Court 3Kerby Court 3 

Using E2Excel button from App Exchange on a 'Related List' in a custom object

We are trying to use the E2Excel "Export to Excel" button (downloaded from the App Exchange) on custom objects and it seems to work if you include it directly on the object, but when we try to lauch the button from a 'Related List' we are getting an error message: 

A problem with the OnClick JavaScript for this button or link was encountered: Cannot read property 'value' of undefined

I have very little experience with Java but here is the code they included in the instructions for installation of the botton on the object:

var str = parent.location.href;
var sobjid=str.substring(str.indexOf("?fcf")-3,str.indexOf("?fcf"));
var idArray = {!GETRECORDIDS('selected')};
var listview = document.getElementsByName('fcf')[0];
var listId = listview.value;
var listName = listview.options[listview.selectedIndex].text;
var idString = JSON.stringify(idArray);
window.open('apex/E2Ex__Export_To_Excel?idString='+idString+'&sobjid='+sobjid+'&listid='+listId+'&listName='+listName);

Again, it has worked 'as expected' when added to the Object. But when trying to use it from a 'related list' we get the error message. The buttom appears on the Related List next to the "New" button. Any help you can offer to sort this out, would be greatly appreciated. 
Deepak Kumar SharmaDeepak Kumar Sharma
Hi Kerby Court,
Hope you are doing good!
Reason behind is that we are using "standard set controller" that can fetch the Filter id from list view only, that is currently in context but in case of related list this filterid is not available.  As i can see, you are trying to export records from related list of  "Object"  but for now we have implemented this for list view only, in the upcoming version we will provide this functionality for related list too. So if you want to export the records from related list then you can export them from list view of that object for now. 

Thanks & Regards :)
Deepak
Derek Hoffritz 10Derek Hoffritz 10
@Deepak, 
Have you been able to provide this functionality for related lists as well? I see you mentioned this will be available in an upcoming version as of your post back in April 2018. 

Thank you, 
Derek