I have a custom Javascript button on the OpportunityLineItem object that brings users to a Visualforce page when clicked. All works fine, however, we utilize Communities for our reseller partners and the URL in the button does not work for their instance since they have an additional "/reseller" component after the standard URL. Does anyone know how I can create and IF/THEN statement to look for that piece in the url? My Javascript is below:


I would need the code below to fire if the URL contained "/reseller"


Please refer this url https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_site.htm

$site.prefix should fulfill your requirement.

Try like

window.open('{!$site.prefix} /apex/opportunityProductEntry?id={!Opportunity.Id}')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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