1

I'm having an issue trying to achieve this:

When the invoice is created with these conditions:

Currency is USD and

billing country is United States, Canada, China, Hong Kong, India, Japan, Philippines, Singapore, Taiwan, United Arab Emirates, Australia, New Zealand, Austria, Belgium, Bulgaria, Croatia, Czech Republic, Denmark, Estonia, Finland, France, Germany, Gibraltar, Guernsey, Greece, Hungary, Iceland, Ireland, Isle of Man, Italy, Jersey, Latvia, Liechtenstein, Luxembourg, Malta, Netherlands, Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, Switzerland, United Kingdom.

Use these bank details:

Account Holder: FocusEconomics SLU Bank Name: TransferWise

So I did this and it's working fine, but just with one condition:

<apex:outputPanel layout="block" rendered="

{!invoice.Contract__r.InvoiceInUSD__c}">
                                   <p><b><u>Wire Transfer</u></b></p>
                                    <p>Account Holder: FocusEconomics SLU<br/>
                                    Bank Name: TransferWise<br/>
                            
</apex:outputPanel>

My question is: How can I add a second condition to check the billingCountry based on a List of Countries that I have to define.

I know I can create the List of countries in the controller but I don't know how to render my apex:outputPanel based on the first condition (currency being USD) AND billingCountry being contained inside the List of countries I will create in the controller.

Could anyone please help me out ??

Thanks a lot

1 Answer 1

2

You can create a new attribute in the controller for this:

public Boolean renderList {get; set;}
private Set<String> allowedCountries = new Set<String>{'Country1', 'Country2',...};
//controller constructor
public Controller(){
    renderList = record.InvoiceInUSD__c && allowedCountries.contains(record.BillingCountry);
}

Then your VF page can just do

<apex:outputPanel rendered="{!renderList}">

Just make sure you're handling all the logic to set renderList in the constructor, otherwise you'll have to rerender.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .