Find your content:

Search form

You are here

Escape parentheses in Formula inside a VF page


I am trying to use the following formula inside a VF page.

<apex:outputField value="{!RIGHT(currentCase.AssetId,LEN(currentCase.AssetId)-(FIND(')-', currentCase.AssetId )+1))}"/>

This returns an error :

Error: Syntax error. Missing ')'

The reason for this error is that the compiler is not interpreting properly this ')-' and thinks I am closing parentheses when what I am doing is searching for those characters.

Any ideas to solve this?


Attribution to: PepeFloyd

Possible Suggestion/Solution #1

<apex:outputField> expects to be passed an sObject in the value paramerter. You should switch your code to use <apex:outputText>.

The missing ')' syntax error is actually misleading and not referring to the ')-' part.

<apex:outputText value="{!RIGHT(currentCase.AssetId,LEN(currentCase.AssetId)-(FIND(')-', currentCase.AssetId )+1))}"/>

Attribution to: Jon Hazan
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content