3

this solution not works on portal please help???

End of javascript sidebar workarounds?

  • need on customer portal urgent???? – Krishnanand Gupta Feb 20 '15 at 6:44
  • 1
    Krishnanand, the sidebar hack was used for a lot of different things. That the fix in that questions doesn't work in portal is just information, and doesn't help us understand what you are trying to do. Can you please post your problem, what you have tried, etc. Follow the guide here: salesforce.stackexchange.com/help/how-to-ask – pchittum Feb 20 '15 at 7:35
  • Hi Peter, we are trying to hide some values of dropdown(picklist) using javascript on page load in salesforce community(portal).but we are not able to do it.How can we do it.Can you please provide a best solution.Thanks for your comment – Krishnanand Gupta Feb 20 '15 at 12:21
  • 1
    So, what are you dealing with: community or portal? There is no community(portal) as you call it ;-) – Uwe Heim Feb 20 '15 at 17:24
  • @Krishnanand, please consider editing your question and moving your comments into your question as this will help SEO and readability of the question. – pchittum Feb 20 '15 at 21:46
2

UPDATE

I've (maybe) read your question wrong and answered it for communities instead of partner portals. But since you are not really clear about what you have, I'm keeping this answer and have updated your question to cover both. So the answer might not be correct if you are really dealing with the (old!) portals. Please verify that. However if you are using communities, your chances are good to make it work. At the moment I can't provide an answer for the old portals. As a rule of thumb, if you have a sidebar and static resources are available via an URL, the workaround might work - otherwise it's likely to fail.

Original answer for Communities

Please mind, that all methods of using javascript or custom CSS to tweak or manipulate the DOM of Standard Pages are not supported by Salesforce. There are several risks you have to be aware of and you need to take full responsibility even in case of errors or data-loss. Also these techniques require higher programming skills and are more error-prone.

After having this caveat emptor emphasized first, the stated workaround should work just fine on communities, too. However you need to make a slight adjustment. The reason for the failure you are facing is the URL under which the static resources are served in communities. The standard pattern

/resource/1402932484000/YourStaticResourceName

is invalid in communities an will result into an error. You need to use this pattern instead:

/resource/YourCommunityName/1402932484000/YourStaticResourceName

As a result, you should be able to use the workaround with similar possibilities and limitations as in the Standard Salesforce UI. If you need the workarounds at both places, you need to work with two different homepage layouts and injection-components.

You might also have a look at this article for the resource-urls: How to reference static resources from a Community HTML header in a cache-compatible way?

2

You should verify if the mere requirement just to "hide some picklist values" is strong enough for justifying workarounds like that. I doubt it.

Please consider those workarounds as desperate measures and a last resort for cases after all supported methods have failed. Unfortunately you are not telling us enough backgrounds to understand what you really need and why.

You might consider and prefer to use official mechanisms like Dependent Picklists or Visualforce Pages or Record Types instead.

To give you an impression for what use cases those workarounds might be considered, you can review this article: Why do we still need to hack the Sidebar? Usecases - Workarounds - Alternatives

  • Actually we want to hide picklist values on community on the basis of profile.we do not want to use vf pages,record types. Going to check about this code "/resource/YourCommunityName/1402932484000/YourStaticResourceName" Will reply soon – Krishnanand Gupta Feb 20 '15 at 19:09
  • Hurrahhh ,this code "YourStaticResourceName /resource/1402932484000/filename" is working.Thanks Uwe Heim, – Krishnanand Gupta Feb 23 '15 at 5:19

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.