+ Start a Discussion
Jose Alvarado 19Jose Alvarado 19 

Visualforce Page column not showing details

I am a beginner developer so I'm sorry if the solution is obvious but I cannot get the Account details that I have added to the outputFields to show under the column that I have created. 

I have created a button on the account object. When clicked, a pop up window opens the visualforce page that I am creating. I believe the issue is that the VF page is not pulling the Account ID since it is opening a new page. So essentially I open an account record, click the button and the table shows up blank. What do I need to do?

Button OnClick JavaScript:

var win = window.open('/apex/ecard?oppId={!Account.Id}&retURL=/apex/ForceWindowClose', 'Popup Name' ,"width=1200, height=2100, scrollbars=yes");
var timer = setInterval(function() {
    if(win.closed) {
        clearInterval(timer);
        window.location.reload();
    }
}, 500);


VF Page:

<apex:page id="pg" standardController="Account" sidebar="false">
<apex:form>
    <apex:pageBlock title="Account">
        <apex:pageBlockTable value="{!Account}" var="a" columns="1">
            <apex:column headerValue="Customer Details">
                <apex:outputField value="{!a.Name}" />
                <apex:outputField value="{!a.Phone}" />
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>

</apex:page>
Best Answer chosen by Jose Alvarado 19
Maharajan CMaharajan C
Hi Jose,

You have to just mention the Id not as oppId in the below first line:   (  ecard?oppId  ==>  ecard?Id  )

var win = window.open('/apex/ecard?Id={!Account.Id}&retURL=/apex/ForceWindowClose', 'Popup Name' ,"width=1200, height=2100, scrollbars=yes");
var timer = setInterval(function() {
    if(win.closed) {
        clearInterval(timer);
        window.location.reload();
    }
}, 500);


Thanks,
Maharajan.C

All Answers

Maharajan CMaharajan C
Hi Jose,

You have to just mention the Id not as oppId in the below first line:   (  ecard?oppId  ==>  ecard?Id  )

var win = window.open('/apex/ecard?Id={!Account.Id}&retURL=/apex/ForceWindowClose', 'Popup Name' ,"width=1200, height=2100, scrollbars=yes");
var timer = setInterval(function() {
    if(win.closed) {
        clearInterval(timer);
        window.location.reload();
    }
}, 500);


Thanks,
Maharajan.C
This was selected as the best answer
Jose Alvarado 19Jose Alvarado 19
I completely overlooked that! Thank you so much. That resolved it.