+ Start a Discussion

Checkbox Visualforce page


I have this VFP and i would like to add checkboxes for every row and create and opportunity but, i can't figure out how to do it... any ideas?

I'll really appreciate your help!

<apex:page standardController="Account" extensions="OrderSummaryAccount" >
    <apex:form >
        <apex:pageBlock title="Summary of products and services">
            <apex:pageBlockTable value="{!os.accountServicesSummaries}" var="item">
              <apex:column headerValue="Service ID">{!item.ServiceId}</apex:column>
                <apex:column headerValue="Service Name">{!item.serviceName}</apex:column>
                <apex:column headerValue="Quantity">{!item.quantity}</apex:column>
                <apex:column headerValue="Price">  <apex:outputText value="{0,number,$#,###,###.00}"><apex:param value="{!item.price}" /></apex:outputText></apex:column>

And this extension

public with sharing class OrderSummaryAccount {
    public OrderSummary os {get;set;}    
    public OrderSummaryAccount(ApexPages.StandardController stdController) {
        Account a = (Account) stdController.getRecord();
        os = OrderSummary.getOrderSummary(a.id);

And this class

public class OrderSummary {

    public String accountId {get;set;}
    public List<AccountServicesSummaries> accountServicesSummaries {get;set;}
  public List<AccountNonBillablesSummaries> accountNonBillablesSummaries {get;set;}
  public List<AccountServiceLocationsSummaries> accountServiceLocationsSummaries {get;set;}   
    public OrderSummary(){
        accountId = '';
        accountServicesSummaries = new List<AccountServicesSummaries>();
        accountNonBillablesSummaries = new List<AccountNonBillablesSummaries>();
        accountServiceLocationsSummaries = new List<AccountServiceLocationsSummaries>();
  public class AccountNonBillablesSummaries {
    public String id {get;set;}
    public String eqpId {get;set;}
    public String eqpName {get;set;}

  public class AccountServicesSummaries {
    public String id {get;set;}
    public String serviceId {get;set;}
    public String serviceName {get;set;}
    public Double quantity {get;set;}
    public Double price {get;set;}

  public class AccountServiceLocationsSummaries {
    public String id {get;set;}
    public String locationName {get;set;}
  public static OrderSummary parse(String json) {
    return (OrderSummary) System.JSON.deserialize(json, OrderSummary.class);
    public static OrderSummary getOrderSummary(String accountId){
        OrderSummary r = new OrderSummary();
        Http http = new Http();
    HttpRequest request = new HttpRequest();
        // Set the body as a JSON object
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
    HttpResponse response = http.send(request);
    // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            r = parse(response.getBody());
            // Cast the values in the 'animals' key as a list            

        return r;
Suraj Tripathi 47Suraj Tripathi 47
Hi ECorona,

To create a button in Visualforce you can try this
<apex:column >
<apex:outputfield value="{//action you want to perform or any URL}"/>
If you find your solution mark this as the best answer.

Thank you!
Suraj Tripathi