0

I am trying to create a VisualForce page which uses remoteObjects in order to add a global quick action to Service Cloud. I want to create a tab in service cloud which has a button called create license, which calls an URL with ID = Case.Service_Contract__c. I keep getting the following Unknown Property Error:

Error: Unknown property 'Case.Service_Contract__r.Id' referenced in CreateLicense

This is my visualforce page:

<apex:page docType="html-5.0" title="Create License">

    <apex:remoteObjects >
        <apex:remoteObjectModel name="Case" fields="Id,Service_Contract__c">
        </apex:remoteObjectModel>
    </apex:remoteObjects>

    <div class="mypage">
        <button onclick="createLicense()">Create License</button>
    </div>

<script src="/support/console/37.0/integration.js" type="text/javascript"></script>
<script>
      function createLicense() {
         window.open("(URL)&ID={!Case.Service_Contract__r.Id}"
                   }  /URL edited out for privacy
    </script>

</apex:page>

I checked all the other questions but they don't mention remoteObjects, just custom controllers, which is not what I am trying to do. Is this even possible using remoteObjects?

  • What's the API version of your VF page ? Must be 35+ – Cloud Ninja Sep 1 '16 at 23:39
  • The API version is 37,0 – Johan de Wild Sep 2 '16 at 7:33
0

You are using a field you have not queried for by using the relationship:

{!Case.Service_Contract__r.Id}

Instead use:

window.open("(URL)&ID={!Case.Service_Contract__c}"

Unfortunately remote objects do not support relationship queries (yet). But in your case you do not need that anyway as the lookup field has the needed ID value inside anyway.

  • Still getting Error: Unknown property 'Case.Service_Contract__c' referenced in CreateLicense. Service_Contract__c is a lookup field. – Johan de Wild Oct 27 '16 at 7:46

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.