Tuesday, July 29, 2014

Rendering problem in visualforce pages

Some time we face problem that some section is not getting re-rendered even if we are re-rendering the section from some action from my experience I have learned most of the time it stop working on the below reasons

1) We are trying to render a pageBlock or pageBlockSection 
2) We have some rendered condition on the section

Solution for point 1 is put an outputPanel and re-render it

<apex:outputPanel id="panel1">
 <apex:pageBlock> ....
</apexoutputPanel>
<apex:actionFunction reRender="panel1">

Solution for point 2 is put an outputPanel and re-render it

<apex:outputPanel id="panel1">
<apex:outputPanel rendered ={condition}>
 <apex:pageBlock> ....
</apexoutputPanel>
</apexoutputPanel>
<apex:actionFunction reRender="panel1">

The reason behind it if we have a rendered condition and the condition became false there is no html outcome hence VF page fails to re-render on second attempt as there is no DOM element for that 

Wednesday, July 16, 2014

Auto Complete in Salesforce

Hi,

In past I have worked on many auto complete for picklist, mainly for look up attributes there are many JavaScript based solution which will give you the solution but there are problems with like if you want to merge two fields like Account Number and Account Name as an option it will be a hard job.

So I have modified a solution I have found on git hub this VF component is very cool and easy to use. Though  you can attach auto complete for the object from out of the box. Please find the attached URL for this 

https://help.salesforce.com/HTViewHelpDoc?id=search_enhanced_lookup_enable_autocomplete.htm&language=en_US

Form my knowledge it is applicable for custom objects as well but the link says it is limited to certain object .


But My problem was some what different I have to show other unique attribute along with the Name or any other configurable field  





It will look like above image as soon you select it will fill the target destination field which need to be hidden I have clubbed BillingCity and Name for example 

Total code can be found at 

https://drive.google.com/file/d/0B5TneolnEkocalh6ZHJrdkg2RXc/edit?usp=sharing

I hope this will help many developers like me who are struggling with type ahead :)  

Thanks,
Avijit 

Tips on passing Salesforce AI Associate Certification

  🌟 Motivation to Pursue the Salesforce AI Associate Certification 🌟 The world of technology is in a state of perpetual evolution, and on...