1

I have a VF page which is working fine in my Salesforce org, but when I try to open it via Partner Community login, I get an error saying "Page is under construction". On further research I found that this is due to the Custom button which actually invokes the page via Javascript as the URL has been coded as '/apex/page/params' but the partner community URL would be '/partnercommunity/page/param'. I am posting my Custom button javascript code below:

{!REQUIRESCRIPT ("/soap/ajax/13.0/connection.js")} 
var selected = {!GETRECORDIDS($ObjectType.Custom_Obj__c)}; 
if (selected[0] == null) { 
alert("Please select at least one record!")
}
else {
window.open('/apex/myVFPage?rec='+selected.join(','), '_blank');
}

This custom button will be available on a list view which when pressed will opena vf page which downloads all the currently selected records. As mentioned, the code is working fine in my org, its only the Partner community which is causing the issue. Could anyone please suggest as to how I need to change the button code so that it works for both internal and external users. Let me know in case any other info is needed.

2
  • did you give access to this page in community? Aug 26, 2016 at 8:09
  • Yes..Access is already been given...Problem is in javascript only as the functionality works if i hard code the URL as '/partnercommunity/page/param'. But I am unable to have a conditional script which would navigate based on the logged in User(Internal or Partner).
    – Sid
    Aug 26, 2016 at 8:44

1 Answer 1

2

Replace the below line

window.open('/apex/myVFPage?rec='+selected.join(','), '_blank');

With

window.parent.location.href="{!URLFOR($Site.Prefix+'/apex/myVFPage?rec=')}"+selected.join(',') 

Let me know if it work for you and please do not forget to mark as answer if it works ! :)

Cheers,

Rajeev :)

1
  • <a class="Buttongry" style="width:100px; text-decoration: none; padding: 1% 6%;" href="{!$Site.Prefix+'/apex/TermsAndConditionPrint'}" target="_blank">{!$Label.c.Print}</a> any idea about how it will work here like this May 16, 2019 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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