4

This is my first Stack Exchange post so bear with me. I am trying to create a Visualforce page to intercept the "New Case" button when an account has a billing status of cancelled. So far this is what I have, any help would be appreciated. I keep getting a Syntax Error for $Action.Case.New

Thanks!

 <apex:page standardController="Case"
action="
  {!
    IF(
        case.Account.Billing_Status__c == 'Cancelled',
                                                URLFOR(
                                                $Page.CasePageMessenger,
            Case.Id,
                                                [id=Case.Id],
            FALSE
        ),
        URLFOR($Action.Case.New,
            Case.Id,
            [retURL="/500"],
            TRUE
        )
    )
  }">
<apex:pageMessage severity="ERROR" 
    strength="3" 
    title="Case Create" 
    summary="This Account is cancelled and can not receive support.">
</apex:pageMessage>
</apex:page>

2 Answers 2

1

If you are trying to reference the standard NewCase Action, then you need to change:

URLFOR($Action.Case.New,Case.Id,[retURL="/500"],TRUE)

to:

URLFOR($Action.Case.NewCase,Case.Id,[retURL="/500"],TRUE)

When using $Action, the 'Case' is the object for the action, and the 'NewCase' is the actual action itself.

4

looks to me like you are missing a comma

URLFOR($Action.Case.New, Case.Id, [retURL="/500"], TRUE )

4
  • You're right. That fixed that error. Now I'm getting a new one. "Unknown property 'CaseStandardController.Account'"
    – Erik Eitel
    Commented Mar 29, 2016 at 19:28
  • Account.Billing_Status__c should be case.Account.Billing_Status__c Commented Mar 29, 2016 at 19:32
  • When I make that update it brings me back to another error on the $Action line. Field $Action.Case.New does not exist. Check spelling
    – Erik Eitel
    Commented Mar 29, 2016 at 19:34
  • Hey guys, see my answer below. Benjamin did the leg work on the first 2 errors, I'm just following through on the final missing piece. Commented Mar 30, 2016 at 14:10

You must log in to answer this question.

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