• jmarinchak
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 11
    Replies

I'm getting this error: Error: Compile Error: Method does not exist or incorrect signature: Commission1(Double, Double, Double, Double) at line 27 column 37.

 

 

<apex:page controller="CommishController"> <apex:form > <apex:pageBlock title="Inputs"> <p><b>Report for {!$User.FirstName} {!$User.LastName}</b></p> <br /> <b>Quota </b> <apex:inputText value="{!Quota}" /> <br /> <b>Variable Salary </b> <apex:inputText value="{!Variable_Salary}" /> <br /><br /> <apex:commandButton action="{!genMyList}" value="Calculate" rerender="MyOpps" status="status"/> <br /> <apex:pageMessages ></apex:pageMessages> </apex:pageBlock> <apex:actionStatus startText="Updating..." id="status"/> <apex:pageBlock title="MyOpps" id="MyOpps" > <apex:dataTable value="{!MyList}" var="aOpp" width="100%"> <apex:column > <apex:facet name="header"><b>AccountId</b></apex:facet> {!aOpp.myopp.Id} </apex:column> <apex:column > <apex:facet name="header"><b>Name</b></apex:facet> {!aOpp.myopp.Name} </apex:column> <apex:column > <apex:facet name="header"><b>Amount</b></apex:facet> {!aOpp.myopp.Amount} </apex:column> <apex:column > <apex:facet name="header"><b>Commission</b></apex:facet> {!aOpp.Commission_Amount} </apex:column> </apex:dataTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

public class CommishController { public PageReference genMyList() { MyList = bMyList(); return null; } public Double Quota {get; set;} public Double Variable_Salary {get; set;} /* New wrapper class */ public class cOpportunity{ public Opportunity myopp {get; set;} public Double Commission_Amount{get; set;} /*This is the constructor method. When we create a new cCommission object we pass a SCRB_Salesorder_c that is set to the corder property. We also set the Commission_Amount value to zero*/ public cOpportunity(Opportunity o,Double Q,Double VS){ myopp = o; if(!(o.Amount==null)){ Double Rate = 0; If (Q > 0) { Rate = VS/Q; } Double myAmount = o.Amount * 1.0; //public Double Commission1(double rev_start, double rev_new, double quota, double rate) { Commission_Amount = Commission1(0.0, myAmount, Q, Rate); }else{ Commission_Amount = 0; } } } //A collection of the class/wrapper objects cOpportunity public List<cOpportunity> MyList {get; set;} //This method uses a SOQL query to return a List of Opportunities public List<cOpportunity> bMyList(){ if(MyList == null){ MyList = new List<cOpportunity>(); for(Opportunity opp : [Select Id, Name, Amount FROM Opportunity ]){ /* As each opportunity is processed I create a new cOpportunity object and add it to MyList */ MyList.add(new cOpportunity(opp,Quota,Variable_Salary)); } } return MyList; } /* This method calculates commission */ public Double Commission1(double rev_start, double rev_new, double quota, double rate) { // Calculates Commission according to the structure below // If the code looks VBA-like, that's because I originally wrote it // as a VBA user defined function back in 2006 // Less than or equal to 100%, 1.0x (calculated based on quota) // Greater than 100% to 150%, 1.5x calculated rate // Greater than 150%, 2.0x calculated rate // Inputs are // REV_START = Revenue at Period Start // REV_NEW = Revenue for the Period // QUOTA = Annual Quota // RATE = Commission Rate Double rev_total; Double c; Double a; Double q150; Double q25; Double myCommish = 0.0; rev_total = rev_start + rev_new; c = rev_total; a = rev_start; q150 = 1.50 * quota; q25 = 0.25 * quota; If (a > q150) { myCommish = 2 * RATE * REV_NEW; } Else { If (A > QUOTA) { If (C > Q150) { myCommish = RATE * ((2 * (C - Q150)) + (1.5 *(Q150 - A))); } Else { myCommish = RATE * 1.5 * (C - A); } } Else { If (C > Q150) { myCommish = RATE * ((2 * (C - Q150)) + (1.5 * Q25 + (QUOTA - A))); } Else { If (C > QUOTA) { myCommish = RATE * ((1.5 * (C - QUOTA)) + (QUOTA - A)); } Else { myCommish = RATE * (C - A); } } } } return myCommish; } }

 

 

 

I'm trying to write a short commission calculation page that takes all opportunities and calculates a commission amount based on users quota and variable salary.  The variable salary and quota should be multiplied together to determine a commission "rate."  The user should navigate to the page, enter their numbers (I could probably store these somplace) and they would get a list of their opportunities, the opportunity amount and a commission amount.  It would also be nice to have the total commission amount listed at the end.
 
If I can get this basic idea working, I would add a few things -
* Date selector - allowing the user to select a date rage (start and end)
* Account selector - allowing the user to select accounts to include (a checkbox approach might work here)
* Group the results by account, show subtotals for each account
* Provide a PDF generation (commission statement)
 
I got a skeleton of the idea put together but, it isn't really working.  I've got a few problems with this code.  The page will render but, I the error below when I press calculate.  I'm also trying to figure out how to capture a number in the inputfield.  This code is using inputext but, I'm really trying to capture number (currency amount) - so I can't use the input values yet and I've just hard coded 10% commission.  How should I capture this amount?  Should I create a custom currency object just to capture the number?
 
System.NullPointerException: Attempt to de-reference a null object
 
Class.ACommissionController.cOpportunity.<init>: line 15, column 33
Class.ACommissionController.getMyList: line 29, column 28
External entry point
 
Thanks in advance for any help you can provide!
 
Jeff
 
Apex Page:
Code:
<apex:page controller="ACommissionController"> 
<apex:form >

  <apex:pageBlock title="Inputs">
      <p><b>Report for {!$User.FirstName} {!$User.LastName}</b></p> <br />
      
      <b>Quota </b>
      <apex:inputText value="{!Quota}" /> <br />
      
      <b>Variable Salary </b>
      <apex:inputText value="{!Variable_Salary}" /> <br /><br />
      
      <apex:commandButton action="{!getMyList}" value="Calculate" rerender="MyOpps" status="status"/> <br />
      <apex:pageMessages ></apex:pageMessages>
  </apex:pageBlock>

  <apex:actionStatus startText="Updating..." id="status"/>
  
  <apex:pageBlock title="MyOpps" >
  <apex:dataTable value="{!MyList}" var="aOpp" width="100%">
     <apex:column >
      <apex:facet name="header"><b>AccountId</b></apex:facet>
      {!aOpp.myopp.Id}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Name</b></apex:facet>
      {!aOpp.myopp.Name}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Amount</b></apex:facet>
      {!aOpp.myopp.Amount}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Commission</b></apex:facet>
     {!aOpp.Commission_Amount}
     </apex:column>
   </apex:dataTable>                
   </apex:pageBlock>
</apex:form>

</apex:page>

 
Controller:
Code:
public class ACommissionController {

    public string Quota {get; set;}
    public string Variable_Salary {get; set;}
    
     /* New wrapper class */
    public class cOpportunity{
        public Opportunity myopp {get; set;}
        public Double Commission_Amount{get; set;}
        
        /*This is the constructor method. When we create a new cCommission object we pass a 
        SCRB_Salesorder_c that is set to the corder property. We also set the Commission_Amount value to zero*/
        public cOpportunity(Opportunity o){
            myopp = o;
            Commission_Amount = o.Amount * 0.10;
        }
    }

    //A collection of the class/wrapper objects cOpportunity
    public List<cOpportunity> MyList {get; set;}
    
    //This method uses a SOQL query to return a List of Opportunities
    public List<cOpportunity> getMyList(){
          if(MyList == null){
            MyList = new List<cOpportunity>();
          }          
             for(Opportunity opp : [Select Id, Name, Amount FROM Opportunity    ]){
                /* As each opportunity is processed I create a new cOpportunity object and add it to MyList */
                MyList.add(new cOpportunity(opp));
            }
        return MyList;
    }
}

 
I'm probably doing something very wrong that is obvious to others but, it's not obvious to me.  Have a look and let me know if you see the problem.  I'm trying to do a quick quota calculation based on orders in the system (we use Scribe to pull orders from our ERP system).  In the user interface, the sales person just enters their quota amount and variable salary. 

Key problem is that the inputfield does not seem to be getting values from the user.

Thanks.

First my controller -

Code:
public class MyCommissionController {

    public Commission__c MyComm {get; set;}
    public Commission__c getMyComm() {
        return MyComm;
    }
 
    //Our collection of the class/wrapper objects cCommission
    private List<cCommission> CommissionList {get; set;}
    public List<cCommission> getCommission(){
        return CommissionList;
    }
    //This method uses a simple SOQL query to return a List of Contacts
    public PageReference getNumbers(){
        if(CommissionList == null){
            CommissionList = new List<cCommission>();
        
            for(SCRB_Salesorder__c c : [Select Customer_PO_Number__c, Name, Amount__c FROM SCRB_SalesOrder__c 
                              WHERE DocumentDate__c  > 2008-10-01]){
                /* As each contact is processed we create a new cContact object and
                add it to the contactList */
                CommissionList.add(new cCommission(c));
            }
        }
        return null;
    }
    
    /* New wrapper class */
    public class cCommission{
        public SCRB_Salesorder__c corder {get; set;}
        public Double Commission_Amount{get; set;}
        
        /*This is the contructor method. When we create a new cCommission object we pass a 
        SCRB_Salesorder_c that is set to the corder property. We also set the Commission_Amount value to zero*/
        public cCommission(SCRB_Salesorder__c c){
            corder = c;
            //if (myquota > 0) {
                /* Commission_Amount = c.Amount__c * myvariable / myquota; */
                Commission_Amount = c.Amount__c * 0.10;
            //} else {
            //    Commission_Amount = 0.0;
            // }
        }
    }
}

 Now the visualforce page:

Code:
<apex:page controller="MyCommissionController"> 
<apex:form >

  <apex:pageBlock title="Inputs" id="WholePage">
      <p><b>Report for {!$User.FirstName} {!$User.LastName}</b></p> <br />
      
      <b>Quota </b>
      <apex:inputField value="{!MyComm.Quota__c}" /> <br />
      
      <b>Variable Salary </b>
      <apex:inputField value="{!MyComm.Variable_Salary__c}" /> <br /><br />
      
      <apex:commandButton action="{!getNumbers}" value="Calculate" rerender="WholePage" status="status"/> <br />
      <apex:pageMessages ></apex:pageMessages>
  </apex:pageBlock>
  
  <apex:actionStatus startText="Updating..." id="status"/>
  
  <apex:pageBlock title="Orders" rendered="{!NOT(ISNULL(MyComm.Quota__c))}" >
  <apex:dataTable value="{!Commission}" var="aOrder" width="100%">
     <apex:column>
      <apex:facet name="header"><b>PO Number</b></apex:facet>
      {!aOrder.corder.Customer_PO_Number__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Name</b></apex:facet>
      {!aOrder.corder.Name}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Amount</b></apex:facet>
      {!aOrder.corder.Amount__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Commission</b></apex:facet>
     {!aOrder.Commission_Amount}
     </apex:column>
   </apex:dataTable>                
   </apex:pageBlock>

</apex:form>

</apex:page>

 


Jeff


Is it possible to retrieve archived records using the officetoolkit?  I've used the standard query call in the past.  Now, I'd like to access archived records.  The standard query call does not seem to return any archived records.
All,
I've created a useful tool that we use for loading opportunity line items starting with a customer quote that is created in Excel.  Users just need to load the customer quote details (partnumber, quantity and price) into the sheet named "CustomerQuote."
 
Our quotes start on row 19 with the Qantity stored in Column B, the "Product Code" stored in Column C, and the Price stored in Column E.  Then, you just click over to the "Setup" sheet and enter the Account = cell B3, Pricebook = cell B4, Opportunity Name = cell B5, expected close date = cell B6, and set the option of patial load (in case the tool finds errors) - to start, set this to "No."
 
After that, you just click on the "Upload Quote" button to load the parts, quantities and prices listed on the "CustomerQuote" sheet into the opportunity.  You will be prompted for your username and password (don't forget to add your token).
 
If you want to avoid typing your username and password each time, you can put your username into cell A1 and your password into cell B1.  (you have to be careful not to share the speadsheet with those values set)
 
Please let me know if you have any problems with the tool. 
 
Enjoy!
 
Grab the tool at the Link below -
 


Message Edited by jmarinchak on 07-21-2008 07:48 AM

Message Edited by jmarinchak on 07-21-2008 05:33 PM

Location
Sunnyvale, CA

Infinera
Infinera is a fast growing company located in the heart of Silicon Valley.  We have developed a solution that we believe will change the economics, operating simplicity, flexibility, reliability and scalability of optical communications networks. At the core of our Digital Optical Network architecture is what we believe to be the world’s only commercially-deployed, large-scale photonic integrated circuit, or PIC. We have used our PIC technology to design a new digital optical communications system called the DTN System.  The DTN System is architected to improve significantly communications service providers’ economics and service offerings as compared to optical systems that do not use large-scale photonic integration. 

Position Description:
Support all facets of the Sales Organization, focusing on business analysis, sales tools & program management. This person will be responsible for driving the rollout and adoption of CRM across the sales organization. In this role, you will partner with sales leaders to ensure that sales performance and operational goals are met. This is an ideal position for someone interested in developing a deep understanding of how a sales organization works.

Qualified candidates will have strong program management skills, creative problem solving skills, proven ability to achieve results in a fast moving, dynamic environment. The successful candidate will be self-motivated and self-directed. Candidates must have a proven ability to work well with diverse groups of colleagues and get results in a matrix resource environment.

Primary Responsibilities
Drive adoption of Salesforce.com with responsibility for assisting sales teams with loading customer quotes and providing base level Salesforce.com training
Create reports and dashboards to track key sales metrics
Assemble bookings forecast information that drives a monthly business review process

Requirements
BS/BA Degree, or equivalent experience
Experience managing and administering Salesforce.com rollout
Excellent command of Microsoft Word, Excel, PowerPoint, Access, Outlook, with a tendency to learn new software.
Need strong Excel skills including understanding of pivot tables and vlookup function
Experience using and administrating CRM applications
Must exhibit solid critical thinking and decision making abilities that result in daily impact on sales
Demonstrated ability to interface with sales people, all levels of management and experience working across multiple functional groups required.
Strength in strategic data interpretation and visual representation of data is critical.
Must possess outstanding organizational and interpersonal skills in managing workload and internal customers.
Ability to handle multiple tasks simultaneously and prioritize accordingly.
Extremely detail oriented.
Must exhibit a high degree of motivation, creativity, and initiative.
Team player with strong sense of responsibility
Ability to work with a minimum level of supervision
Expertise in gathering and analyzing information and implementing process enhancements.
Excellent written and verbal communication skills.

Qualifications
Previous experience in Sales, Finance, or Marketing within a reporting and analysis environment.
Previous Sales Operations experience preferred
5+ years experience in a related field
MBA preferred
Enterprise sales experience a plus

Interested candidates should send a copy of your resume to: jmarinchak@infinera.com

We are looking for a full-time Salesforce.com Administrator located in Sunnyvale, CA.
 
This person will enhance and maintain our existing Salesforce.com Application, which includes day-to-day management and customization.
 
Must have a good understanding of accounts, opportunities, opportunities, opportunity line items, pricebooks, products.  We have created standalone applications that automatically load opportunities based on customer quotes with a nice VB.net application.  Understanding of (and experience using)VB.net is a definite plus.
 
We are integrating our Great Plains ERP system to Salesforce.com using Scribe.  Knowledge of Scribe is also a plus. 
 
Please reply to this post for further information.
 
No consultancy replies please, this is for a permanent job position.

To apply for this position, please contact :

Jeff Marinchak
jmarinchak at infinera dot com
Infinera (http://www.infinera.com)
Sunnyvale, CA

Position Description:
Support all facets of the Sales Organization, focusing on business analysis, sales tools & program management. This person will be primarily responsible for driving the rollout and adoption of CRM across the sales organization. In this role, you will partner with sales leaders to ensure that sales performance and operational goals are met. This is an ideal position for someone interested in developing a deep understanding of how a sales organization works.

Qualified candidates will have strong program management skills, creative problem solving skills, proven ability to achieve results in a fast moving, dynamic environment. The successful candidate will be self-motivated and self-directed. Candidates must have a proven ability to work well with diverse groups of colleagues and get results in a matrix resource environment.

Primary Responsibilities
Drive rollout of Salesforce.com with responsibility for assisting sales teams with loading customer quotes and providing base level Salesforce.com training
Create summary dashboards and detailed reports to track key sales metrics
Assemble bookings forecast information to support demand forecast creation to drive prioritization and capacity planning
Reconcile customer requirements against product availability and delivery to meet customer needs


Requirements
BS/BA Degree, or equivalent experience
Experience managing and administering Salesforce.com rollout
Excellent command of Microsoft Word, Excel, PowerPoint, Access, Outlook, with a tendency to learn new software.
Need strong Excel skills including understanding of pivot tables and vlookup function
Experience using and administrating CRM applications
Must exhibit solid critical thinking and decision making abilities that result in daily impact on sales and operational result.
Demonstrated ability to interface with sales people, all levels of management and experience working across multiple functional groups required.
Strength in strategic data interpretation and visual representation of data is critical.
Must possess outstanding organizational and interpersonal skills in managing workload and internal customers.
Ability to handle multiple tasks simultaneously and prioritize accordingly.
Extremely detail oriented.
Must exhibit a high degree of motivation, creativity, and initiative.
Team player with strong sense of responsibility and administration skills
Ability to work with a minimum level of supervision required
Expertise in gathering and analyzing information and implementing process enhancements.
Excellent written and verbal communication skills.

Qualifications
Previous experience in Sales, Finance, or Marketing within a reporting and analysis environment.
Previous Sales Operations experience preferred
5+ years experience in a related field
MBA preferred
Enterprise sales experience a plus

I'm using the WWW::Salesforce::Simple module and I can login and read objects but, I can't create anything.
 
My code is:
use strict;
use WWW::Salesforce::Simple;
use SOAP::Lite +trace => 'debug';
my $sforce = WWW::Salesforce::Simple->new(
        'username' => $ARGV[0],
        'password' => $ARGV[1]
);
my %j_task = (type => 'Task', Subject => "Contact Jeff", Description => "Description Placeholder");
$sforce->create(%j_task);
 
The output is:
C:\Perl>perl create_lead.pl username password
SOAP::Transport::HTTP::Client::send_receive: POST
https://www.salesforce.com/services/Soap/u/8.0
Accept: text/xml
Accept: multipart/*
Content-Length: 584
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP=ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:login xmlns:namesp1="urn:partner.soap.sforce.com"><username xsi:type="xsd:string">username</username><password xsi:type="xsd:string">password</password></namesp1:login></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 23 Mar 2007 22:35:32 GMT
Server:
Content-Length: 615
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 23 Mar 2007 22:35:28 GMT
Client-Peer: 204.14.234.33:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign
International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Salesforce.com, I
nc./OU=Applications/OU=Terms of use at
www.verisign.com/rpa (c)00/CN=www.salesforce.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>sf:INVALID_LOGIN</faultcode><faultstring>INVALID_LOGIN: Invalid username or password or locked out.</faultstring><detail><sf:faultxsi:type="sf:LoginFault"><sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode><sf:exceptionMessage>
Invalid username or password or locked out.</sf:exceptionMessage></sf:fault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
INVALID_LOGIN: Invalid username or password or locked out. at create_lead.pl line 6
Can't call method "create" without a package or object reference at create_lead.pl line 15.
I'm trying to write a short commission calculation page that takes all opportunities and calculates a commission amount based on users quota and variable salary.  The variable salary and quota should be multiplied together to determine a commission "rate."  The user should navigate to the page, enter their numbers (I could probably store these somplace) and they would get a list of their opportunities, the opportunity amount and a commission amount.  It would also be nice to have the total commission amount listed at the end.
 
If I can get this basic idea working, I would add a few things -
* Date selector - allowing the user to select a date rage (start and end)
* Account selector - allowing the user to select accounts to include (a checkbox approach might work here)
* Group the results by account, show subtotals for each account
* Provide a PDF generation (commission statement)
 
I got a skeleton of the idea put together but, it isn't really working.  I've got a few problems with this code.  The page will render but, I the error below when I press calculate.  I'm also trying to figure out how to capture a number in the inputfield.  This code is using inputext but, I'm really trying to capture number (currency amount) - so I can't use the input values yet and I've just hard coded 10% commission.  How should I capture this amount?  Should I create a custom currency object just to capture the number?
 
System.NullPointerException: Attempt to de-reference a null object
 
Class.ACommissionController.cOpportunity.<init>: line 15, column 33
Class.ACommissionController.getMyList: line 29, column 28
External entry point
 
Thanks in advance for any help you can provide!
 
Jeff
 
Apex Page:
Code:
<apex:page controller="ACommissionController"> 
<apex:form >

  <apex:pageBlock title="Inputs">
      <p><b>Report for {!$User.FirstName} {!$User.LastName}</b></p> <br />
      
      <b>Quota </b>
      <apex:inputText value="{!Quota}" /> <br />
      
      <b>Variable Salary </b>
      <apex:inputText value="{!Variable_Salary}" /> <br /><br />
      
      <apex:commandButton action="{!getMyList}" value="Calculate" rerender="MyOpps" status="status"/> <br />
      <apex:pageMessages ></apex:pageMessages>
  </apex:pageBlock>

  <apex:actionStatus startText="Updating..." id="status"/>
  
  <apex:pageBlock title="MyOpps" >
  <apex:dataTable value="{!MyList}" var="aOpp" width="100%">
     <apex:column >
      <apex:facet name="header"><b>AccountId</b></apex:facet>
      {!aOpp.myopp.Id}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Name</b></apex:facet>
      {!aOpp.myopp.Name}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Amount</b></apex:facet>
      {!aOpp.myopp.Amount}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Commission</b></apex:facet>
     {!aOpp.Commission_Amount}
     </apex:column>
   </apex:dataTable>                
   </apex:pageBlock>
</apex:form>

</apex:page>

 
Controller:
Code:
public class ACommissionController {

    public string Quota {get; set;}
    public string Variable_Salary {get; set;}
    
     /* New wrapper class */
    public class cOpportunity{
        public Opportunity myopp {get; set;}
        public Double Commission_Amount{get; set;}
        
        /*This is the constructor method. When we create a new cCommission object we pass a 
        SCRB_Salesorder_c that is set to the corder property. We also set the Commission_Amount value to zero*/
        public cOpportunity(Opportunity o){
            myopp = o;
            Commission_Amount = o.Amount * 0.10;
        }
    }

    //A collection of the class/wrapper objects cOpportunity
    public List<cOpportunity> MyList {get; set;}
    
    //This method uses a SOQL query to return a List of Opportunities
    public List<cOpportunity> getMyList(){
          if(MyList == null){
            MyList = new List<cOpportunity>();
          }          
             for(Opportunity opp : [Select Id, Name, Amount FROM Opportunity    ]){
                /* As each opportunity is processed I create a new cOpportunity object and add it to MyList */
                MyList.add(new cOpportunity(opp));
            }
        return MyList;
    }
}

 
I'm probably doing something very wrong that is obvious to others but, it's not obvious to me.  Have a look and let me know if you see the problem.  I'm trying to do a quick quota calculation based on orders in the system (we use Scribe to pull orders from our ERP system).  In the user interface, the sales person just enters their quota amount and variable salary. 

Key problem is that the inputfield does not seem to be getting values from the user.

Thanks.

First my controller -

Code:
public class MyCommissionController {

    public Commission__c MyComm {get; set;}
    public Commission__c getMyComm() {
        return MyComm;
    }
 
    //Our collection of the class/wrapper objects cCommission
    private List<cCommission> CommissionList {get; set;}
    public List<cCommission> getCommission(){
        return CommissionList;
    }
    //This method uses a simple SOQL query to return a List of Contacts
    public PageReference getNumbers(){
        if(CommissionList == null){
            CommissionList = new List<cCommission>();
        
            for(SCRB_Salesorder__c c : [Select Customer_PO_Number__c, Name, Amount__c FROM SCRB_SalesOrder__c 
                              WHERE DocumentDate__c  > 2008-10-01]){
                /* As each contact is processed we create a new cContact object and
                add it to the contactList */
                CommissionList.add(new cCommission(c));
            }
        }
        return null;
    }
    
    /* New wrapper class */
    public class cCommission{
        public SCRB_Salesorder__c corder {get; set;}
        public Double Commission_Amount{get; set;}
        
        /*This is the contructor method. When we create a new cCommission object we pass a 
        SCRB_Salesorder_c that is set to the corder property. We also set the Commission_Amount value to zero*/
        public cCommission(SCRB_Salesorder__c c){
            corder = c;
            //if (myquota > 0) {
                /* Commission_Amount = c.Amount__c * myvariable / myquota; */
                Commission_Amount = c.Amount__c * 0.10;
            //} else {
            //    Commission_Amount = 0.0;
            // }
        }
    }
}

 Now the visualforce page:

Code:
<apex:page controller="MyCommissionController"> 
<apex:form >

  <apex:pageBlock title="Inputs" id="WholePage">
      <p><b>Report for {!$User.FirstName} {!$User.LastName}</b></p> <br />
      
      <b>Quota </b>
      <apex:inputField value="{!MyComm.Quota__c}" /> <br />
      
      <b>Variable Salary </b>
      <apex:inputField value="{!MyComm.Variable_Salary__c}" /> <br /><br />
      
      <apex:commandButton action="{!getNumbers}" value="Calculate" rerender="WholePage" status="status"/> <br />
      <apex:pageMessages ></apex:pageMessages>
  </apex:pageBlock>
  
  <apex:actionStatus startText="Updating..." id="status"/>
  
  <apex:pageBlock title="Orders" rendered="{!NOT(ISNULL(MyComm.Quota__c))}" >
  <apex:dataTable value="{!Commission}" var="aOrder" width="100%">
     <apex:column>
      <apex:facet name="header"><b>PO Number</b></apex:facet>
      {!aOrder.corder.Customer_PO_Number__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Name</b></apex:facet>
      {!aOrder.corder.Name}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Amount</b></apex:facet>
      {!aOrder.corder.Amount__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Commission</b></apex:facet>
     {!aOrder.Commission_Amount}
     </apex:column>
   </apex:dataTable>                
   </apex:pageBlock>

</apex:form>

</apex:page>

 


Jeff


I'm using version 2.0 of the SForceOfficeToolkit in a VB.NET application. I can programmatically log in to our production site. What I want to do is log in to our sandbox programmatically.
 
sf = CreateObject("SForceOfficeToolkit.SForceSession")
sf.Login("xxx@companyname.com","pw", False)
 
This works fine against our production. The following properties are populated:
 
sf.ServerURL
sf.OrganizationName
sf.SessionID
etc.
 
My question is, how do I get this code (or what do I need to add to this code) to get the SForceSession to point to our sandbox?
 
I thought of this, but it does not seem to work.
sf.SetServerUrl("https:tapp0.salesforce.com/005T0000000nLJo")  ' url of our sandbox
 
The properties above are not populated, even though the login seems to work.
 
It seems like SForceSession needs to be configured somehow to point to the sandbox, but I don't know how.
 
Any help is appreciated.
 
Thanks,
 
Randy
    I have developed an application in Visual Basic 6 that logs into SalesForce successfully. The application runs successfully in VB, but when I compile it and run it as a standalone prorgramme, the login fails.
    With a view to understanding this problem, I have created identical applications in Access and Excel, and used the same login method as in vb - both fail. The Access application in particular uses identical code.
    This problem has only arisen since Sales Force introduced the concept of concatinated passwords and security tokens.

Has anyone else had this problem, and if so, is there a workaround? Code snippets are attached.

Thanks,

Neil

Code Snippets:
'Log into SalesForce
If SampleLogin(Me.txtSF_User, Me.txtSF_Password) = True Then
    MsgBox "Logged in", vbOKOnly, "SalesForce"
    'CreateAccount
Else
    MsgBox "Login Failed"
    Unload Me

Public Function SampleLogin(Username, Password) As Boolean
Set g_SFApi = New SForceOfficeToolkitLib3.SForceSession3
SampleLogin = g_SFApi.Login(Me.txtSF_User, Me.txtSF_Password)
End Function


Hi

I downloaded the module Salesforce-0.57 & also WWW-Salesforce-0.082, with installing it into, directly use the modules in the sample script and tring to login.
But it fails.
I don't know what i am missing out.

Could any body please help me.

We i went through the documents on developer.force.com i can see the step for java and .net only.
If any body got links or documents for Perl, will help me great.

Thanks
Balaji
I'm using the WWW::Salesforce::Simple module and I can login and read objects but, I can't create anything.
 
My code is:
use strict;
use WWW::Salesforce::Simple;
use SOAP::Lite +trace => 'debug';
my $sforce = WWW::Salesforce::Simple->new(
        'username' => $ARGV[0],
        'password' => $ARGV[1]
);
my %j_task = (type => 'Task', Subject => "Contact Jeff", Description => "Description Placeholder");
$sforce->create(%j_task);
 
The output is:
C:\Perl>perl create_lead.pl username password
SOAP::Transport::HTTP::Client::send_receive: POST
https://www.salesforce.com/services/Soap/u/8.0
Accept: text/xml
Accept: multipart/*
Content-Length: 584
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP=ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:login xmlns:namesp1="urn:partner.soap.sforce.com"><username xsi:type="xsd:string">username</username><password xsi:type="xsd:string">password</password></namesp1:login></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 23 Mar 2007 22:35:32 GMT
Server:
Content-Length: 615
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 23 Mar 2007 22:35:28 GMT
Client-Peer: 204.14.234.33:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign
International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Salesforce.com, I
nc./OU=Applications/OU=Terms of use at
www.verisign.com/rpa (c)00/CN=www.salesforce.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>sf:INVALID_LOGIN</faultcode><faultstring>INVALID_LOGIN: Invalid username or password or locked out.</faultstring><detail><sf:faultxsi:type="sf:LoginFault"><sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode><sf:exceptionMessage>
Invalid username or password or locked out.</sf:exceptionMessage></sf:fault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
INVALID_LOGIN: Invalid username or password or locked out. at create_lead.pl line 6
Can't call method "create" without a package or object reference at create_lead.pl line 15.