Monday, June 24, 2019

Tips and Trick : Make apex:column value display conditionally

When try to make apex:column display conditionally there high possibility we try to code like below which will prompt Syntax error. Missing ')' .Unfortunately this is documented in any where so far.



<apex:column headerValue="Actual Approver" value="{!IF(item.objectType=='Qualification',item.bid.Actual_Final_Approver__c,item.quote.Actual_Final_Approver__c)}"></apex:column>

apex:column cannot being rendered directly in value tag but we can render it different way like below
    <apex:column headerValue="Actual Approver">
                    <apex:outputField rendered="{!item.objectType=='Qualification'}"
                                      value="{!item.bid.Actual_Final_Approver__c}"/>
                    <apex:outputField rendered="{!item.objectType=='Quote'}"
                                      value="{!item.quote.Actual_Final_Approver__c}"/>
                </apex:column>
The render is done not in value tag in column but use render tag in component like outputText, outputField inside apex:column. Note that using outputField for lookup field will generate standard mini page layout when we mouse over on the link.

Reference : apex:column

Monday, February 25, 2019

Tips and Tricks : Avoid $$ in ANT password

Today we faced weird issue. ANT throwing Invalid User Password although we know exactly what our password.We able to login directly into Salesforce site but we failed to login via ANT.

It delays our deployment process because we struggle to figure out why.

  • Double check the password [Done]
  • Reset the password[Done]
  • Check proxy[Done]


Thankfully I found this tips : Password Issue in ANT . I suspect it may due to this

Property Expansion
When Ant encounters a construct ${some-text} the exact parsing semantics are subject to the configured property helper delegates.
$$ Expansion
In its default configuration Ant will expand the text $$ to a single $ and suppress the normal property expansion mechanism for the text immediately following it, i.e., $${key} expands to ${key} and not value even though a property named key was defined and had the value value. This can be used to escape literal $ characters and is useful in constructs that only look like property expansions or when you want to provide diagnostic output like in Read More...

Anyone has better explanation please comment.For this time being, it's better avoid $$ or more than two $ in password.