0

I want to change the background color depending on the prefix....the command I'm trying to use has given a syntax error, where am I going wrong? Or is this idea not possible

<body style="{!if(!$Site.Prefix == '/portalEllas',background: #164E4B,background: #0c4453)}">

1 Answer 1

2

In your case, the output must be a string (enclosed in quotes). You also potentially have an extra !; the ! in a merge formula is part of the merge syntax, as in {!...}. Anywhere else besides that, ! acts as the NOT() function. Field names are not ordinarily prefixed with !. If you use it as written, it effectively makes the condition: $Site.Prefix != '/portalEllas', which is probably not what you meant.

<body style="{!if($Site.Prefix == '/portalEllas','background: #164E4B','background: #0c4453')}">

You can optimize this by moving the background out of the formula:

<body style="background: {!if($Site.Prefix == '/portalEllas','#164E4B','#0c4453')}">
1
  • Thankyou !! Thanks for the help again @sfdcfox
    – Souza
    Feb 24 at 19:29

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.