0

I hava a visualforce page in which standardController is Contact.

<apex:page standardController="Contact">

</apex:page>
<script>
        var company = {!URLENCODE(Account.Name)};//Error comes on this line
</script>

It is not allowing me to save the visualforce page and the error is

Unknown property 'ContactStandardController.Account'

  • 1
    Try contact.Account.Name – AeJey Mar 30 '17 at 9:52
  • 1
    You will also hit a compile error for the markup. Your script tags need to be within the <apex:page></apex:page> tags. – TSmith Mar 30 '17 at 10:03
2

You cant call Account.Name directly.

Use the code below

    var company = {!URLENCODE(contact.Account.Name)};

instead of

    var company = {!URLENCODE(Account.Name)};

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.