• Dpal
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies

Hi,

 

I have a custom payment object that is the basis for a page to save new payments.

 

I also want to attach multiple sales orders to these payments using a list with checkboxes.

 

So the process:

1.  New payment

2.  Choose Account for payment

      2.5  The list of sales orders without payments for this account rerenders (onblur event)

3.  Enter the amount and Date

4.  Check from the list which sales orders apply to this payment

5.  Click Save (actually process records at the moment)

 

All of that works great.

 

Unfortunately, when I go to save the Payment - only information that was input before the onblur event kicked off is saved.

 

For instance, usually the user enter's the Description(name) and then the Account.  The list of sales orders is refreshed based on the Account. On save, the amount and date don't get saved.  If you enter the amount, then the Description and then the Account - the amount is saved.

 

I have tried every thing I can think of and none of it made a dent.  Any help would be greatly appreciated.

 

note on the code: its got left over stuff in it at the moment commented out from various attempts - i also removed the checkboxsave since the problem happens before that.

<apex:page standardController="PF_Payment__c" extensions="PaymentsExtension"> <p/> <apex:form > <apex:pageBlock title="Payments"> <table> <tr cellpadding="4"> <td>Description:</td> <td> <apex:inputField value="{!PF_Payment__c.name}" required="true"/></td> </tr> <tr> <td>Account: </td> <td><apex:inputField id="ifAccount" value="{!PF_Payment__c.Account__c}"> <apex:actionSupport event="onblur" rerender="salesorderlistblock"/> </apex:inputField></td> </tr> <tr> <td>Amount:</td> <td><apex:inputField id="pAmount" value="{!PF_Payment__c.Amount__c}"/> </td> </tr> <tr> <td>Date Paid:</td> <td><apex:inputField value="{!PF_Payment__c.Date_Paid__c}"/> </td> </tr> <tr> <td>Status:</td> <td><apex:inputField value="{!PF_Payment__c.Status__c}"/> </td> </tr> </table> </apex:pageBlock> </apex:form> <apex:form > <apex:pageblock id="salesorderlistblock"> <apex:pageBlockButtons > <apex:commandButton value="Process Selected" action="{!Save}" rerender="returninfo"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!Sales_Order}" var="salesorder" cellpadding="4" border="2"> <apex:column headervalue="Sales Order">{!salesorder.so.name}</apex:column> <apex:column headervalue="Record Type">{!salesorder.so.recordtype.name}</apex:column> <apex:column headervalue="Creation Date">{!salesorder.so.createddate}</apex:column> <apex:column headervalue="Description">{!salesorder.so.Description__c}</apex:column> <apex:column headervalue="Price">{!salesorder.so.Price__c}</apex:column> <!-- <apex:column headervalue="Payment">{!salesorder.so.Payment__c}</apex:column> --> <!-- <apex:column headervalue="Payment">{!salesorder.so.Payment__r.name}</apex:column> --> <apex:column headervalue="Add to Payment"> <!-- onclick="!setCurrentStatus('something happened')" --> <apex:inputCheckbox value="{!salesorder.selected}"/> <!--<input id="thecheckbox" type="checkbox" value="{!salesorder.selected}" name="thecheckbox" /> --> <!-- <apex:actionSupport action="{!CurrentStatus}" event="onclick" rerender="returninfo"/> --> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageblock id="returninfo"> Current Status: {!CheckBoxDebug} </apex:pageblock> </apex:form> </apex:page>

and the extension

 

 

public class PaymentsExtension { public PF_Payment__c pymt; ApexPages.StandardController controller; public PaymentsExtension(ApexPages.StandardController controller) { this.pymt = (PF_Payment__c)controller.getRecord(); this.controller = controller; } private String CurrentStatus = 'Nothing has happened'; public String getCheckBoxDebug() { return CurrentStatus; } public PageReference CurrentStatus() { CurrentStatus = CurrentStatus + ' something '; return null; } List<saleswrapper> salesorderList = new List<saleswrapper>(); List<Sales_Order__c> selectedsalesorders = new List<Sales_Order__c>(); public PageReference Save() { controller.save(); /*upsert this.pymt didn't work*/ /*this.pymt.save(); didnt work*/ PageReference home = new PageReference('/a08/o'); home.setRedirect(true); return home; /* return home; */ } public PageReference getSelected() { selectedsalesorders.clear(); for(saleswrapper sw : salesorderList) if(sw.selected == true) selectedsalesorders.add(sw.so); /* CurrentStatus='something happened'; */ return null; } public List<saleswrapper> getSales_Order() { string queryid = pymt.Account__c; /*= Accountif */ if (queryid != null) { salesorderlist.clear(); for(Sales_Order__c s : [Select id, name, RecordTypeid, RecordType.Name, CreatedBy.Name, CreatedDate, Description__c, Price__c, Payment__c, Payment__r.name from Sales_Order__c where Payment__c = NULL AND Account__c = :queryid]) { salesorderlist.add(new saleswrapper(s)); } } else { for(Sales_Order__c s : [Select id, name, RecordTypeid, RecordType.Name, CreatedBy.Name, CreatedDate, Description__c, Price__c, Payment__c, Payment__r.name from Sales_Order__c where Payment__c = NULL AND Account__c = :System.currentPageReference().getParameters().get('accountid')]) salesorderlist.add(new saleswrapper(s)); /*return salesorderlist; */ } return salesorderlist; } public class saleswrapper { public Sales_Order__c so {get; set;} public Boolean selected {get; set;} public string sonumber {get; set;} public saleswrapper(Sales_Order__c s) { so = s; selected = false; } } }

 

 

 

Message Edited by Dpal on 06-11-2009 11:50 PM
  • June 12, 2009
  • Like
  • 0

Hi,

 

I have a custom payment object that is the basis for a page to save new payments.

 

I also want to attach multiple sales orders to these payments using a list with checkboxes.

 

So the process:

1.  New payment

2.  Choose Account for payment

      2.5  The list of sales orders without payments for this account rerenders (onblur event)

3.  Enter the amount and Date

4.  Check from the list which sales orders apply to this payment

5.  Click Save (actually process records at the moment)

 

All of that works great.

 

Unfortunately, when I go to save the Payment - only information that was input before the onblur event kicked off is saved.

 

For instance, usually the user enter's the Description(name) and then the Account.  The list of sales orders is refreshed based on the Account. On save, the amount and date don't get saved.  If you enter the amount, then the Description and then the Account - the amount is saved.

 

I have tried every thing I can think of and none of it made a dent.  Any help would be greatly appreciated.

 

note on the code: its got left over stuff in it at the moment commented out from various attempts - i also removed the checkboxsave since the problem happens before that.

<apex:page standardController="PF_Payment__c" extensions="PaymentsExtension"> <p/> <apex:form > <apex:pageBlock title="Payments"> <table> <tr cellpadding="4"> <td>Description:</td> <td> <apex:inputField value="{!PF_Payment__c.name}" required="true"/></td> </tr> <tr> <td>Account: </td> <td><apex:inputField id="ifAccount" value="{!PF_Payment__c.Account__c}"> <apex:actionSupport event="onblur" rerender="salesorderlistblock"/> </apex:inputField></td> </tr> <tr> <td>Amount:</td> <td><apex:inputField id="pAmount" value="{!PF_Payment__c.Amount__c}"/> </td> </tr> <tr> <td>Date Paid:</td> <td><apex:inputField value="{!PF_Payment__c.Date_Paid__c}"/> </td> </tr> <tr> <td>Status:</td> <td><apex:inputField value="{!PF_Payment__c.Status__c}"/> </td> </tr> </table> </apex:pageBlock> </apex:form> <apex:form > <apex:pageblock id="salesorderlistblock"> <apex:pageBlockButtons > <apex:commandButton value="Process Selected" action="{!Save}" rerender="returninfo"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!Sales_Order}" var="salesorder" cellpadding="4" border="2"> <apex:column headervalue="Sales Order">{!salesorder.so.name}</apex:column> <apex:column headervalue="Record Type">{!salesorder.so.recordtype.name}</apex:column> <apex:column headervalue="Creation Date">{!salesorder.so.createddate}</apex:column> <apex:column headervalue="Description">{!salesorder.so.Description__c}</apex:column> <apex:column headervalue="Price">{!salesorder.so.Price__c}</apex:column> <!-- <apex:column headervalue="Payment">{!salesorder.so.Payment__c}</apex:column> --> <!-- <apex:column headervalue="Payment">{!salesorder.so.Payment__r.name}</apex:column> --> <apex:column headervalue="Add to Payment"> <!-- onclick="!setCurrentStatus('something happened')" --> <apex:inputCheckbox value="{!salesorder.selected}"/> <!--<input id="thecheckbox" type="checkbox" value="{!salesorder.selected}" name="thecheckbox" /> --> <!-- <apex:actionSupport action="{!CurrentStatus}" event="onclick" rerender="returninfo"/> --> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageblock id="returninfo"> Current Status: {!CheckBoxDebug} </apex:pageblock> </apex:form> </apex:page>

and the extension

 

 

public class PaymentsExtension { public PF_Payment__c pymt; ApexPages.StandardController controller; public PaymentsExtension(ApexPages.StandardController controller) { this.pymt = (PF_Payment__c)controller.getRecord(); this.controller = controller; } private String CurrentStatus = 'Nothing has happened'; public String getCheckBoxDebug() { return CurrentStatus; } public PageReference CurrentStatus() { CurrentStatus = CurrentStatus + ' something '; return null; } List<saleswrapper> salesorderList = new List<saleswrapper>(); List<Sales_Order__c> selectedsalesorders = new List<Sales_Order__c>(); public PageReference Save() { controller.save(); /*upsert this.pymt didn't work*/ /*this.pymt.save(); didnt work*/ PageReference home = new PageReference('/a08/o'); home.setRedirect(true); return home; /* return home; */ } public PageReference getSelected() { selectedsalesorders.clear(); for(saleswrapper sw : salesorderList) if(sw.selected == true) selectedsalesorders.add(sw.so); /* CurrentStatus='something happened'; */ return null; } public List<saleswrapper> getSales_Order() { string queryid = pymt.Account__c; /*= Accountif */ if (queryid != null) { salesorderlist.clear(); for(Sales_Order__c s : [Select id, name, RecordTypeid, RecordType.Name, CreatedBy.Name, CreatedDate, Description__c, Price__c, Payment__c, Payment__r.name from Sales_Order__c where Payment__c = NULL AND Account__c = :queryid]) { salesorderlist.add(new saleswrapper(s)); } } else { for(Sales_Order__c s : [Select id, name, RecordTypeid, RecordType.Name, CreatedBy.Name, CreatedDate, Description__c, Price__c, Payment__c, Payment__r.name from Sales_Order__c where Payment__c = NULL AND Account__c = :System.currentPageReference().getParameters().get('accountid')]) salesorderlist.add(new saleswrapper(s)); /*return salesorderlist; */ } return salesorderlist; } public class saleswrapper { public Sales_Order__c so {get; set;} public Boolean selected {get; set;} public string sonumber {get; set;} public saleswrapper(Sales_Order__c s) { so = s; selected = false; } } }

 

 

 

Message Edited by Dpal on 06-11-2009 11:50 PM
  • June 12, 2009
  • Like
  • 0

All --

 

This is my first time using VF and creating a controller (shocker) and I have hit a roadblock with a project I am working on.  I have a page that is executed from the opportunity that pulls the current opportuninty and account ID to display some pertinent information from the account and opportunity as well as providing a list of available product inventory.  I have built the page and controller by reviewing the docs and a ton of forum post regarding wrapper classes and the use of checkboxes in a VF form page.  I have most of the controller built but I do not understand how to pull it all together and insert the account and opp IDs into my customer inventory object.  The goal is to loop through the list of invetory items that are selected and have the current Account and Opp IDs updated in the Inventory object.  Here is the controller:

 

 

public class InventoryController { Account account; Opportunity opportunity; Inventory__c inventory; public Account getAccount() { return [select id, name, fice_code__c, resellers_name__c, type from Account where id = :ApexPages.currentPage().getParameters().get('accid')]; } public Opportunity getOpportunity() { return [select id, name, amount, type, closedate from Opportunity where id = :ApexPages.currentPage().getParameters().get('oppid')]; } public List<cInventory> inventoryList {Get; Set;} public List<cInventory> getInventory(){ if (inventoryList == null){ inventoryList = new List<cInventory>(); for(Inventory__c c : [select Id, name, inventory_type__c, status__c, MAC_Address__c, Hard_Drive_Serial__c, FPIO_serial__c, ExIO_Card_Serial_optional__c, Appliance_Ateme_Serial__c, Build_date__c, account__r.id, account__r.name from Inventory__c where status__c = 'available' and (inventory_type__c = 'sales' or inventory_type__c = 'trial') ORDER BY Build_date__c ASC limit 1000]){ inventoryList.add(new cInventory(c)); } } return inventoryList; } public PageReference processSelected(){ List<Inventory__c> selectedInventory = new List<Inventory__c>(); for(cInventory cCon : getInventory()){ if(cCon.selected == true){ selectedInventory.add(cCon.con); } } PageReference oppPage = new PageReference ('/' + ApexPages.currentPage().getParameters().get('oppid')); oppPage.setRedirect(true); return oppPage; } public class cInventory{ public Inventory__c con {get; set;} public Boolean selected {get; set;} public cInventory(Inventory__c c){ con = c; selected = false; } } }

 

 and the VF page:

 

 

<apex:page Controller="InventoryController" tabStyle="Inventory__c"> <apex:form id="theForm"> <apex:pageBlock title="Account Information"> <apex:pageBlockSection Title="Account Section"> <apex:pageBlockTable value="{!account}" var="account"> <apex:column value="{!account.id}"/> <apex:column value="{!account.Name}"/> <apex:column value="{!account.FICE_Code__c}"/> <apex:column value="{!account.Resellers_Name__c}"/> <apex:column value="{!account.type}"/> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockSection title="Opportunity Section"> <apex:pageBlockTable value="{!opportunity}" var="opp"> <apex:column value="{!opp.id}"/> <apex:column value="{!opp.Name}"/> <apex:column value="{!opp.type}"/> <apex:column value="{!opp.amount}"/> <apex:column value="{!opp.closedate}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Inventory Information"> <apex:pageBlockButtons > <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Select Inventory"> <apex:dataTable value="{!inventory}" var="c" styleClass="list"> <apex:column > <apex:facet name="header">Select</apex:facet> <apex:inputCheckbox value="{!c.selected}" /> </apex:column> <apex:column > <apex:facet name="header">MAC Address</apex:facet> <apex:outputText value="{!c.con.MAC_Address__c}" /> </apex:column> <apex:column > <apex:facet name="header">Appliance Serial Number</apex:facet> <apex:outputText value="{!c.con.name}" /> </apex:column> <apex:column > <apex:facet name="header">Inventory Type</apex:facet> <apex:outputText value="{!c.con.Inventory_Type__c}" /> </apex:column> <apex:column > <apex:facet name="header">Inventory Status</apex:facet> <apex:outputText value="{!c.con.Status__c}" /> </apex:column> <apex:column > <apex:facet name="header">Build Date</apex:facet> <apex:outputText value="{!Month(c.con.Build_Date__c)}/{!Day(c.con.Build_Date__c)}/{!YEAR(c.con.Build_Date__c)}" /> </apex:column> <apex:column > <apex:facet name="header">Account Name</apex:facet> <apex:outputText value="{!c.con.account__r.name}" /> </apex:column> </apex:dataTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 I am looking for a way to execute the update on the Inventory__c custom object and appreciate any sample code or references that folks can provide to help with this.

 

Thanks in advance and again sorry for being a noob.

 

Wes

 

 

 

Hello, I have the next simple scenario:
 
scontrol which calls an apex class that calls ASP.NET webservice as the following :
(all is working fine)
 
global class WSIchlusSalesForceHelper
{
    global class ContactIchlus
    {
            webservice String ContactRole;
            webservice String BirthDate;
            webservice String arg1;
            webservice String arg2;
            webservice String arg3;
            webservice String arg4;
            ...
            ...
    }
 
    WebService static string test1(ContactIchlus data)
    {
        WSIchlusSalesForce.ServiceIchlusSoap soap = new WSIchlusSalesForce.ServiceIchlusSoap();
        return soap.IchlusProtocol(data.BirthDate);
     }
}
 
My question is,
In the inner class ContactIchlus which will have at least 20 variables or more, that I need to pass to the webservice...
I can't just pass the variable data...
 
Is there a simple way to convert that inner class to XML and pass it to the webservice ?
or I will have to concat string and build the xml myself ?
or maybe I will have to define 20 args to the webservice
 
TIA (it's my first webservice)
  • October 16, 2008
  • Like
  • 0