Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

My custom button works in normal Salesforce UI, but not working in Customer Portal.

OnClick JavaScript:

var contactIds = {!GETRECORDIDS($ObjectType.Contact)}; 
if (contactIds.length != 2) { 
    alert("Exactly 2 Contact records are to be selected"); 
} else { 
    alert("Okay"); 
}

Why is this only working in Salesforce UI and not in Customer Portal? On clicking the custom button, how to get IDs of checked/ticked records, from list view, in Customer Portal?

share|improve this question
1  
What is it doing or not doing? Things can "not work" in multiple ways. –  Jeremy Nottingham Jan 14 '13 at 11:44
    
@JeremyNottingham, thanks for asking for clarification. In normal Salesforce UI, the contactIds.length can detect exactly how many checkboxes are checked, even if they are checked in different pages of the List View. However, in Customer Portal, contactIds.length is always zero, irrespective of the number of checkboxes checked; therefore, the flow in Customer Portal is always entering the if block. –  Suman Krishna Saha Jan 14 '13 at 13:15
add comment

1 Answer

up vote 3 down vote accepted

The list view which is presented in the native platform UI is a lot more sophisticated than the one presented in the Customer Portal. Your JavaScript is not the problem, nor is the getRecordIds function. This is a limitation of the feature in the portal itself.

When navigating between pages of a list view in the customer portal, the page does not retain the state of the selections on previous pages.

The difference in functionality can clearly be seen through the 'selected records' indication in the footer of a native list view counting the number of items selected per page. The portal provides no such information, because it is non-existent (as of Winter '13). The less enhanced functionality can also be seen by the exhibited behavior of losing prior selections when navigating between pages of the list view in the portal.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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