I have to open an order object which is linked to a case and the case is further linked to contact.

I have to get an Edit contact button on Order to edit the order information.

I have created a button with

Content Source As : URL

In the body of the code : /apex/{!Order__c.Case__c}/e?&retURL=/{!Case.Id}&saveURL=/{!Case.Id}

but I am not able to get the Contact object using this since


thows message of Invalid URl . Please suggest

  • Remove the /apex i.e. use /{!Order__c.Case__r.ContactId}/e?&retURL=/{!Case.Id}&saveURL=/{!Case.Id} as you appear to be using the default URL pattern rather than a Visualforce page. – Keith C Aug 8 '14 at 11:59
  • Even after using this I am getting the error that {!Order__c.Case__r.ContactId} does not exist – user2703132 Aug 8 '14 at 12:14
  • Can't we use the look up fields of the case to populate contact – user2703132 Aug 8 '14 at 12:15
  • What are you trying to accomplish with this button again? You say you are trying to edit the Order, but it seems like you are trying to get to the edit screen for the contact from the order page. Is that what you are trying to accomplish? – Chris Duncombe Aug 8 '14 at 12:20
  • 4
    I'm voting to close this question as off-topic because it appears to be abandoned. – Adrian Larson Nov 10 '16 at 19:41

{!Order__c.Case__r.ContactId} is a typo?

If you have a custom object called Order__c, the relationship is Order__r


If you're using standard Order Object, is it


And then the Case Id reference is {!Order.Case__c}?

| improve this answer | |
  • Order is a custom object for me and case object is standard.I have tried this but this is not working {!Order__r.Case__r.ContactId} – user2703132 Aug 8 '14 at 13:29
  • 1
    You were right the first time, with {!Order__c.Case__r.ContactId}. Your URL is invalid because it has ?& next to each other. Try taking the first & out – Dominic Aug 8 '14 at 15:41
  • I am getting the error "Error: Field Order__c.Case__r.ContactId does not exist. Check spelling." for {!Order__c.Case__r.ContactId} – user2703132 Aug 9 '14 at 6:48
  • Does your Order__c object have a field called Case__c that is a link to the standard Case object? – Dominic Aug 10 '14 at 10:54
  • yes, Order__c is having a look up for case – user2703132 Aug 10 '14 at 12:48

Your URL should be:


ContactId is a standard field on Case, so doesn't require the custom __r relationship syntax.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.