+ Start a Discussion
BobBob 

Changing a S-Control to a visualforce Button

i am trying to convert a S-Control to a visualforce button and i keep getting an

ErrorError: Unknown property 'OpportunityStandardController.Account'

 This is to allow the user to print opportunity information and send it to a customer.

 

Do i start off the apex code with <apex:page standardController="Opportunity">

 

some of the beginning code looks like this:

 

<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>
<script src="/js/dojo/0.3.1/dojo.js"></script>
<script src="/soap/ajax/8.0/apex.js"></script>

<script>

    function startPage() {
        var envurl = location.protocol + "//" + location.host + "/";
        var user = sforce.connection.getUserInfo().userEmail;
        document.getElementById('reply_to').value = user;

        var accountId = "{!Account.Id}";
        var oppID = "{!Opportunity.Id}";
        var oppUrl = envurl + oppID;

        var AccountSQL = "SELECT a.Id, a.Name FROM Account a where a.Id = '" + accountId + "'";

ErikssonEriksson

Hi,

 

I noticed that you are using merge field like "{!Account.Id}", since the standardController is Opportunity, that's why you get the error message. If you want to get the account id, you can use this "{!Opportunity.AccountId}". And if you can provide the completed script to get more help from other people.

 

Cheers