• Erik Rodgers
  • NEWBIE
  • 35 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 20
    Replies
I'm looking into adding pagination capabilities to a couple of our visualforce pages and was wonder which is the preferred methods for accomplishing pagination. I've seen ApexPages.StandardSetController used as well as a method using SOQL offset. Which is best or good / bad of each? Thanks.
While writing a test class for a trigger handler I encountered a situation (while creating a new opportunity record) where the Account field on the opportunity, which is a lookup to the Account parent record, required me to use SOQL in the constructor rather than just assigning the account ID directly. Can anyone please explain why this is necessary for some lookups and not others? Here is the code that worked:

Opportunity newOpportunity = new Opportunity(
                                    CloseDate=date.Today(), 
                                    StageName='Quoted', 
                                    Name='Test Op', 
                                    Account=[SELECT Id FROM Account WHERE Id= :newAccount.Id]);
 
We have added several new custom fields to the opportunity object, yet none of these fields are accessible via the API or our Jitterbit Middleware tool. The tool uses a user who is assigned a profile called System Integration. This profile has edit capabilities on each of the new fields. Is there any other reason these fields would not be accessible through SOQL?
I am fairly new to Apex and I am looking at some existing code in my Org written by a consultant. In one of our classes there is an sObject property/variable declared for a custom object. Later, in another method, I see lines of code where it appears the developer is using this sObject variable as a Map with the .put method.

Here are the declarations at the class level:

    public Apttus_Proposal__Proposal__c newQuote{get;set;}
    public String assignToParam{get;set;}
    public Id assignToValue{get;set;}

And here is the assignment statement to which I was referring:

    newQuote.put(assignToParam, assignToValue);

This makes no sense to me. Can someone please explain how this works or what it is doing to the sObject?

Thanks.

V/R,
Erik
 
I have a visualforce page with a pageBlockTable. I would like one of the columns to be a dynamically selected (checked or unchecked) apex:inputCheckbox driven by a String value from my object array. Here is the line I am using: 

<apex:inputCheckbox selected="{!IF(orderHeaderData.has_order_hold == 'Y',true,false)}" disabled="true" />

I am getting the following error:
Syntax error. Missing ')'

I am not able to use a true boolean, so I am trying to use an expression to return a boolean based on my String value. I would appreciate any help with why this won't work.

Thanks.
I'm attempting what I believe to be a fairly simple and straight-forward SOQL query to get fields from the Salesforce Order Product (OrderItem) standard object. I am also attempting to reference a couple fields on the Product (Product2) object that is related to Order Product via lookup field Product. Here is my query:

SELECT Id,
       OrderId,   
       OrderItemNumber,
       Product2.Name,
       Quantity,
       UnitPrice
  FROM OrderItem

All profiles has field level visibility off all fields, but the query errors with "INVALID FIELD - No such relation Product2 on entity OrderItem." What am I doing wrong. This field most certainly exists as a lookup to the Product object. The query runs fine if I take out "Product2.Name"
Below is an excerpt from some code we use to make a web service call to a Twilio API in our production environment. It appears very straight forward, but I am new to Force.com Apex syntax, so I'm trying to understand things that just don't make sense to me. So, how does the Map object accept two (2) String parameters for the name/value pair, but the code in the braces represents three (3) Strings - To, From, and Body. 2 is not equal to 3, so I am confused. I know this is a dumb newbie question, but I have to know.

    Map<String,String> params = new Map<String,String> {
        'To'   => toNumber,
        'From' => String.isBlank(twilioCfg.From_Phone_Number__c) ? '+15005550006' : twilioCfg.From_Phone_Number__c,
        'Body' => smsBody
    };

Thanks!
Erik
Hello. I am new to the Force.com platform and I am trying to understand how to access the "value" parameter value of the SelectedOption for the <apex:selectList> or <apex:selectOptions> components when the page is submitted. I want to access this selected value from my doSave method. I have searched the forum and see where a developer can bind a variable to the "label" for the Selected Option, but not the "value". For example, if I add the following SelectedOptions:

options.add(new SelectOption('789521','Some Category'));
options.add(new SelectOption('986521','Some Other Category'));
options.add(new SelectOption('143254','Yet Another Category'));

Then in my doSave method, I need to be able to access the value of the selected option (e.g., 986521) - not the label (Some Other Category) - for processing. The label was only useful for displaying to the user, not for processing (as the value I placed in the SelectOption is actually a key in an external system with which we integrate). Since we pass this value as part of the constructor for SelectOption, I would only assume there is some way to access it when submitted server-side. I would greatly appreciate any help the community can provide. Thanks!
 
Can anyone explain where the getProducts() method is actually being invoked in the lesson "Using Inner Classes" of the Apex Workbook? I do not see anywhere in the Visualforce markup, or the StoreFrontController (constructor or otherwise) where this method gets invoked.

http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex_visualforce_5.htm
 
While writing a test class for a trigger handler I encountered a situation (while creating a new opportunity record) where the Account field on the opportunity, which is a lookup to the Account parent record, required me to use SOQL in the constructor rather than just assigning the account ID directly. Can anyone please explain why this is necessary for some lookups and not others? Here is the code that worked:

Opportunity newOpportunity = new Opportunity(
                                    CloseDate=date.Today(), 
                                    StageName='Quoted', 
                                    Name='Test Op', 
                                    Account=[SELECT Id FROM Account WHERE Id= :newAccount.Id]);
 
We have added several new custom fields to the opportunity object, yet none of these fields are accessible via the API or our Jitterbit Middleware tool. The tool uses a user who is assigned a profile called System Integration. This profile has edit capabilities on each of the new fields. Is there any other reason these fields would not be accessible through SOQL?
I am fairly new to Apex and I am looking at some existing code in my Org written by a consultant. In one of our classes there is an sObject property/variable declared for a custom object. Later, in another method, I see lines of code where it appears the developer is using this sObject variable as a Map with the .put method.

Here are the declarations at the class level:

    public Apttus_Proposal__Proposal__c newQuote{get;set;}
    public String assignToParam{get;set;}
    public Id assignToValue{get;set;}

And here is the assignment statement to which I was referring:

    newQuote.put(assignToParam, assignToValue);

This makes no sense to me. Can someone please explain how this works or what it is doing to the sObject?

Thanks.

V/R,
Erik
 
I have a visualforce page with a pageBlockTable. I would like one of the columns to be a dynamically selected (checked or unchecked) apex:inputCheckbox driven by a String value from my object array. Here is the line I am using: 

<apex:inputCheckbox selected="{!IF(orderHeaderData.has_order_hold == 'Y',true,false)}" disabled="true" />

I am getting the following error:
Syntax error. Missing ')'

I am not able to use a true boolean, so I am trying to use an expression to return a boolean based on my String value. I would appreciate any help with why this won't work.

Thanks.
I'm attempting what I believe to be a fairly simple and straight-forward SOQL query to get fields from the Salesforce Order Product (OrderItem) standard object. I am also attempting to reference a couple fields on the Product (Product2) object that is related to Order Product via lookup field Product. Here is my query:

SELECT Id,
       OrderId,   
       OrderItemNumber,
       Product2.Name,
       Quantity,
       UnitPrice
  FROM OrderItem

All profiles has field level visibility off all fields, but the query errors with "INVALID FIELD - No such relation Product2 on entity OrderItem." What am I doing wrong. This field most certainly exists as a lookup to the Product object. The query runs fine if I take out "Product2.Name"
Below is an excerpt from some code we use to make a web service call to a Twilio API in our production environment. It appears very straight forward, but I am new to Force.com Apex syntax, so I'm trying to understand things that just don't make sense to me. So, how does the Map object accept two (2) String parameters for the name/value pair, but the code in the braces represents three (3) Strings - To, From, and Body. 2 is not equal to 3, so I am confused. I know this is a dumb newbie question, but I have to know.

    Map<String,String> params = new Map<String,String> {
        'To'   => toNumber,
        'From' => String.isBlank(twilioCfg.From_Phone_Number__c) ? '+15005550006' : twilioCfg.From_Phone_Number__c,
        'Body' => smsBody
    };

Thanks!
Erik
Hello. I am new to the Force.com platform and I am trying to understand how to access the "value" parameter value of the SelectedOption for the <apex:selectList> or <apex:selectOptions> components when the page is submitted. I want to access this selected value from my doSave method. I have searched the forum and see where a developer can bind a variable to the "label" for the Selected Option, but not the "value". For example, if I add the following SelectedOptions:

options.add(new SelectOption('789521','Some Category'));
options.add(new SelectOption('986521','Some Other Category'));
options.add(new SelectOption('143254','Yet Another Category'));

Then in my doSave method, I need to be able to access the value of the selected option (e.g., 986521) - not the label (Some Other Category) - for processing. The label was only useful for displaying to the user, not for processing (as the value I placed in the SelectOption is actually a key in an external system with which we integrate). Since we pass this value as part of the constructor for SelectOption, I would only assume there is some way to access it when submitted server-side. I would greatly appreciate any help the community can provide. Thanks!
 
Can anyone explain where the getProducts() method is actually being invoked in the lesson "Using Inner Classes" of the Apex Workbook? I do not see anywhere in the Visualforce markup, or the StoreFrontController (constructor or otherwise) where this method gets invoked.

http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex_visualforce_5.htm