• SeanMS
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 16
    Replies

Hello,

 

In my Developer account I've created a custom picklist field on the Contact object. I added a validation rule to this field to enforce the selection of a value. This custom field was packaged up and installed into my Sandbox account for testing. However, when I create a new Contact record, the custom field is greyed out as if it is read-only (unlike in my Dev account whereby you can use the field, select a value). The field is not flagged read-only at the field definition level or the page layout level. Why could this be happening? Thanks for any help!

 

Here is my validation rule...

Error Condition Formula   ISPICKVAL(custom__Type__c, "Unassigned")
Error Message   Please select a Type

 

 

 

 

  • March 29, 2010
  • Like
  • 0

I have a C# method that uses the sforce API to upsert only one custom object record. I copied all of the detail (the setting of the object properties etc) and changed this upsert call to update multiple records instead (passing in an array of sObjects instead of one sObject). However, when I run the new method I get this error...

 

"Unable to create/update fields: External_Salesforce_ID__c. Please check the security settings of this field and verify that it is read/write for your profile."

 

INVALID_FIELD_FOR_INSERT_UPDATE

 

Why would the same code work for upserting one record but not upserting multiple records? I'm at a loss.

 

Thanks for any ideas.

 

// Original Code...
public bool UpsertCustomAccountRecord(Custom_Account__c upsertObject)
{
bool upsertSuccess = false;
sObject[] upserts = new Custom_Account__c[1];
upserts[0] = upsertObject;

UpsertResult[] upsertResult = Binding.upsert("External_Salesforce_Id", upserts);

if (upsertResult[0].success)
{
upsertSuccess = true;
}
else
{
upsertErrors = new Error[upsertResult[0].errors.Length];
upsertErrors = upsertResult[0].errors;
}
...
...


// New code...
public UpsertResult[] UpsertBatchCustomAccountRecords(List<Custom_Account__c> upsertObjects)
{
sObject[] upserts = new Custom_Account__c[upsertObjects.Count];
upserts = upsertObjects.ToArray();

UpsertResult[] upsertResults = Binding.upsert("External_Salesforce_Id", upserts);

return upsertResults;
...
...

 


Message Edited by SeanMS on 12-11-2009 11:36 AM
  • December 11, 2009
  • Like
  • 0

Hello,

 

I have added a section to the Account Detail Page that points to a VisualForce Page. From the VF Page I have a button that the user needs to click and after some operations I want the current page to redirect to a Contact Page. This is working, but the new page gets loaded into the small section on the Account Detail page instead of the full window. How can I reload the entire window?

 

Here's the code at the bottom of my Apex method that gets called when the button is clicked...

 

 

PageReference newContactPage = new ApexPages.StandardController(newContactRec).view(); newContactPage.setRedirect(true); return newContactPage;

 

Thanks!

 

 

 

 

  • November 21, 2009
  • Like
  • 0

I have a custom controller for a list display. I've seen a lot on the discussion boards about how when using a custom controller that you have to make use of the StandardSetController methods in order to get Pagination working. I've tried to set this up, but I'm having trouble. When the list is first loaded, all is good (the first ten records are displayed), but when I click the 'next' button the entire recordset is loaded in addition to the first ten records (instead of the next ten records, we now have duplicates and 30 records). Can someone please point me in the right direction for correcting this?

 

TIA!

 

Controller Code:

 

public with sharing class OrderListController2
{
List<OrderListRowWrapper> orderList = new List<OrderListRowWrapper>();

public ApexPages.StandardSetController setCon
{
get {
if (setCon == null)
{
setCon = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Order_ID__c
FROM Order_Details__c
ORDER BY LastModifiedDate DESC]));

setCon.setPageSize(10);
}
return setCon;
}
set;
}

public OrderListController2() {
}

public OrderListController2(ApexPages.StandardSetController controller) {
}

public List<OrderListRowWrapper> getOrderList()
{
Order_Details__c[] orderListRecords = (Order_Details__c[])setCon.getRecords();

if (orderListRecords != null)
{
// For each Order List Row...
for (Order_Details__c thisOrderListItem : orderListRecords)
{
OrderListRowWrapper thisRowWrapper = new OrderListRowWrapper(thisOrderListItem.Order_ID__c);
orderList.Add(thisRowWrapper);
}
}

return orderList;
}

public PageReference nextPage() {
setCon.next();
return null;
}

public PageReference prevPage() {
setCon.previous();
return null;
}

public List<sObject> dataObjects {
get {
return setCon.getRecords();
}
}

public Integer currentPage {
get {
return setCon.getPageNumber();
}
}

public Integer totalPages {
get {
return setCon.getResultSize();
}
}

public Boolean hasPrevious {
get {
return setCon.getHasPrevious();
}
}

public Boolean hasNext {
get {
return setCon.getHasNext();
}
}

public PageReference moveNext() {
setCon.next();
return null;
}

public PageReference movePrevious() {
setCon.previous();
return null;
}

}

 

VisualForce Page:

 

 

<apex:page controller="OrderListController2" title="Orders">
<style type="text/css">
// TO DO
</style>
<apex:form id="navigation">
<table bgcolor="white" width="100%">
<tr>
<td width="160"><img src="{!$Resource.HeaderLogo}" /></td>
<td align="left">
<apex:actionRegion >
<apex:outputText value="Records per page: "></apex:outputText>
<apex:selectList value="{!setCon.pagesize}" size="1">
<apex:selectOption itemLabel="10" itemValue="10"></apex:selectOption>
<apex:selectOption itemLabel="20" itemValue="20"></apex:selectOption>
<apex:selectOption itemLabel="50" itemValue="50"></apex:selectOption>
<apex:selectOption itemLabel="100" itemValue="100"></apex:selectOption>
<apex:actionSupport event="onchange" rerender="thePage, navigation" status="theStatus" />
</apex:selectList>
<BR />
<apex:actionStatus id="theStatus" startText="Updating the list..." stopText="Total records: {!setCon.resultSize}" />
</apex:actionRegion>
</td>
<td align="right">
<apex:outputPanel styleClass="prevNext" layout="block" rendered="{!OR(setCon.hasNext,setCon.hasPrevious)}">
<apex:outputPanel rendered="{!NOT(setCon.hasPrevious)}" styleClass="greyedLink">&lt; Previous Page</apex:outputPanel>
<apex:commandLink rendered="{!setCon.hasPrevious}" action="{!movePrevious}" rerender="thePage">&lt; Previous Page</apex:commandLink>
<span> | </span>
<apex:outputPanel rendered="{!NOT(setCon.hasNext)}" styleClass="greyedLink">Next Page &gt;</apex:outputPanel>
<apex:commandLink rendered="{!setCon.hasNext}" action="{!moveNext}" rerender="thePage">Next Page &gt;</apex:commandLink>
</apex:outputPanel>

<!-- <apex:panelGrid columns="2" id="navTop">
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
</apex:panelGrid>
-->
</td>
</tr>
<tr><td colspan="3"></td></tr>
</table>
</apex:form>
<apex:pageBlock id="thePage" title="Orders">
<apex:form id="theForm">
<!--<apex:pageBlockSection >-->
<!--<apex:pageBlockTable var="o" value="{!orders}">-->
<apex:pageBlockTable var="o" value="{!orderList}" id="theOrderList">
<apex:column >
<apex:facet name="header"><b>Order #</b></apex:facet>
<a href="/{!o.Id}" target="_self">{!o.OrderID}</a>
</apex:column>
<apex:column >
<apex:facet name="header"><b>Date</b></apex:facet>
<a href="/{!o.Id}" target="_self">{!o.OrderDate}</a>
</apex:column>
<apex:column >
<apex:facet name="header"><b>Customer</b></apex:facet>
{!o.CustomerName}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Total ($)</b></apex:facet>
${!o.Total}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Status</b></apex:facet>
{!o.Status}
</apex:column>
<apex:column >
<apex:facet name="header"><b>P/E Date</b></apex:facet>
{!o.PEDate}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Shipped</b></apex:facet>
{!o.ShippedDate}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Site</b></apex:facet>
{!o.Site}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Order Source</b></apex:facet>
{!o.OrderSource}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Tran ID</b></apex:facet>
{!o.TransactionId}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Promo Code</b></apex:facet>
{!o.PromoCode}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Order Type</b></apex:facet>
{!o.BillingType}
</apex:column>
<apex:column >
<apex:facet name="header"><b>Salesperson</b></apex:facet>
{!o.Salesperson}
</apex:column>
</apex:pageBlockTable>
<!--</apex:pageBlockSection>-->
<apex:outputPanel styleClass="prevNext" layout="block" rendered="{!OR(setCon.hasNext,setCon.hasPrevious)}">
<apex:outputPanel rendered="{!NOT(setCon.hasPrevious)}" styleClass="greyedLink">&lt; Previous Page</apex:outputPanel>
<apex:commandLink rendered="{!setCon.hasPrevious}" action="{!prevPage}" rerender="thePage">&lt; Previous Page</apex:commandLink>
<span> | </span>
<apex:outputPanel rendered="{!NOT(setCon.hasNext)}" styleClass="greyedLink">Next Page &gt;</apex:outputPanel>
<apex:commandLink rendered="{!setCon.hasNext}" action="{!nextPage}" rerender="thePage">Next Page &gt;</apex:commandLink>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
</apex:page>

 

 

 

 

  • November 06, 2009
  • Like
  • 0

Hello All,

 

I've tried to create a wrapper class, calling it from a controller, and ultimately a VisualForce Page. The code is compiling without error, but when I load the Page that includes this VisualForce Page as an embedded section, I get the following error...

 

Attempt to de-reference a null object

An unexpected error has occurred. Your development organization has been notified.

 

I'm not sure what I'm doing wrong. I only need to display this data, don't need any buttons etc.

 

The basic structure of my object represents an *Order* that can have 0-n Shipping Locations and each Shipping Location can have 0-n Items, like this...

 

Order

----> Shipping Location

------------------------> Order Item

------------------------> Order Item

------------------------> Order Item

------------------------> Order Item

----> Shipping Location

------------------------> Order Item

------------------------> Order Item

------------------------> Order Item

----> Shipping Location

------------------------> Order Item

 

 

Here's my code so far. Can someone clue me into what I might be doing wrong? I have a feeling that it might be in the VF code??

 

 

// Apex Wrapper Class
public class shippingLocationWrapper
{
public Shipping_Location__c location { get; set; }
public List<Order_Item__c> items { get; set; }

public shippingLocationWrapper(Decimal locId)
{
location = [select Id, Last_Name__c, First_Name__c, Address_Type__c, Gift_Note__c,
Shipping_Company_Name__c, Street__c, Shipping_Method__c, City__c, State_Province__c,
Postal_Code__c, Delivery_Date__c, Phone__c, Email__c, Subtotal__c, Shipping_Location_Id__c
from Shipping_Location__c where Shipping_Location_Id__c = :locId];

populateItems(locId);
}

public void populateItems(Decimal locId)
{
Order_Item__c[] itemsArray = [select Order_Item_ID__c, Shipping_Location_Id__c, SKU__c, Image_Path__c,
Name__c, Quantity__c, Weight__c, Supplier__c, Dropship__c, Shipping_Location_Name__c,
Status__c, Price__c, Ext_Price__c, Mods__c, Design__c, Text1__c, Wear_Date__c
from Order_Item__c where Shipping_Location_Id__c = :locId];


// For each Shipping Location, create a shippingLocationWrapper object...
for (Order_Item__c thisItem : itemsArray)
{
// Store the Order Item into the items List...
items.Add(thisItem);
}

}
}

 

// Apex Controller Class
public class shippingLocationController
{
public shippingLocationController (ApexPages.StandardController controller) {}

public List<shippingLocationWrapper> getLocations()
{
List<shippingLocationWrapper> shippingLocationObjs = null;

// Select all Shipping Locations linked to this Order...
Shipping_Location__c[] locations = [select Id, Last_Name__c, First_Name__c, Address_Type__c, Gift_Note__c,
Shipping_Company_Name__c, Street__c, Shipping_Method__c, City__c, State_Province__c,
Postal_Code__c, Delivery_Date__c, Phone__c, Email__c, Subtotal__c, Shipping_Location_Id__c
from Shipping_Location__c where Order_Rel__c = :ApexPages.currentPage().getParameters().get('id')];

// For each Shipping Location, create a shippingLocationWrapper object...
for (Shipping_Location__c loc : locations)
{
shippingLocationWrapper thisLocation = new shippingLocationWrapper(loc.Shipping_Location_Id__c);

// Store the shippingLocationWrapper in the shippingLocationObjs List...
shippingLocationObjs.Add(thisLocation);
}

return shippingLocationObjs;
}
}

// Order Details VisualForce Page
<apex:page standardController="Order_Details__c" extensions="shippingLocationController">
<apex:stylesheet value="{!$Resource.E6MasterStyles}"/>
<apex:pageBlock >
<table width="100%">
<apex:repeat var="loc" value="{!Locations}">
<tr><td colspan="3"><b>Ship To:</b></td></tr>
<tr><td class="smallText"><b>{!loc.location.Last_Name__c}, {!loc.location.First_Name__c} ({!loc.location.Address_Type__c})</b></td><td class="smallText">Gift Note: {!loc.location.Gift_Note__c}</td><td class="smallText">Shipping Company: {!loc.location.Shipping_Company_Name__c}</td></tr>
<tr><td class="smallText">{!loc.location.Street__c}</td><td class="smallText"></td><td class="smallText">Shipping Method: {!loc.location.Shipping_Method__c}</td></tr>
<tr><td class="smallText">{!loc.location.City__c}, {!loc.location.State_Province__c} {!loc.location.Postal_Code__c}</td><td class="smallText"></td><td class="smallText">Delivery Date: {!loc.location.Delivery_Date__c}</td></tr>
<tr><td colspan="3" class="smallText">Phone: {!loc.location.Phone__c}</td></tr>
<tr><td colspan="3" class="smallText">Email: {!loc.location.Email__c}</td></tr>
<tr><td colspan="3" class="smallText">&nbsp;</td></tr>
<tr><td>&nbsp;</td><td></td><td></td></tr>

<!-- ORDER ITEM TABLE WILL BE HERE -->
<tr>
<td colspan="3">
<table width="100%">
<!-- ORDER ITEM HEADER ROW : DataTable? -->
<tr><td></td></tr>
<!-- Need to loop through the Order Item Objects here : loc.items.x -->
<tr><td></td></tr>
<!-- END loop through Order Item Objects -->
</table>
</td>
</tr>

<tr><td>&nbsp;</td><td></td><td></td></tr>
<tr><td colspan="3" class="smallText">Subtotal: {!loc.location.Subtotal__c}</td></tr>
<tr><td>&nbsp;</td><td></td><td></td></tr>

</apex:repeat>
</table>
</apex:pageBlock>
</apex:page>

 

 Thank you!!

 

  • October 27, 2009
  • Like
  • 0

Hello,

 

I need some guidance on how to pass an integer parameter from a VisualForce Page into a controller extension function (or constructor?). Thank you for any help you can provide as I feel SO close! :)

 

Here's the VisualForce Code:

-------------------------------

<apex:page standardController="Order_Details__c" extensions="OrderItemController">

      <apex:pageBlock>

          <table border="0" width="100%">

          <apex:repeat var="cx" value="{!Order_Details__c.Shipping_Locations2__r}">

              <tr><td><b>Ship To:</b></td></tr>

              <tr><td><b>{!cx.Last_Name__c}, {!cx.First_Name__c} ({!cx.Address_Type__c})</b></td></tr>

              <tr><td>{!cx.Street__c}</td></tr>

              <tr><td>{!cx.City__c}, {!cx.State_Province__c} {!cx.Postal_Code__c}</td></tr>

              <tr><td>Phone: {!cx.Phone__c}</td></tr>

              <tr><td>Email: {!cx.Email__c}</td></tr>

              <tr><td>&nbsp;</td></tr>

             

              <tr><td>

             <!-- Next line/area is where I need to pass the current value of {!cx.Shipping_Location_Id__c} to either the getOrderItemList function or set it in another function. How do I do this? -->

                  <apex:pageBlockTable value="{!OrderItemList}" var="item">

                     <apex:column  value="{!item.SKU__c}"/>

                     <apex:column value="{!item.Name__c}"/>

                     <apex:column value="{!item.Quantity__c}"/>

                     <apex:column value="{!item.Weight__c}"/>

                     <apex:column value="{!item.Supplier__c}"/>

                     <apex:column value="{!item.Dropship__c}"/>

                     <apex:column value="{!item.Status__c}"/>

                     <apex:column value="{!item.Price__c}"/>

                     <apex:column value="{!item.Ext_Price__c}"/>

                  </apex:pageBlockTable>

              </td></tr>

             

              <tr><td>&nbsp;</td><td></td><td></td></tr>

          </apex:repeat>

          </table>

      </apex:pageBlock>

</apex:page>

 

 

Here's the Controller Function:

-------------------------------

public class OrderItemController {

 

    public OrderItemController(ApexPages.StandardController controller) { }

   

    public Order_Item__c[] getOrderItemList()

    {

          return [select Order_Item_ID__c, Shipping_Location_Id__c, SKU__c, Image_Path__c,

              Name__c, Quantity__c, Weight__c, Supplier__c, Dropship__c, Shipping_Location_Name__c,

Status__c, Price__c, Ext_Price__c from Order_Item__c where Shipping_Location_Id__c = 5395]; // ß- this needs to come from a variable/parameter that is passed from the VF Page

    }

}

 

 

  • October 23, 2009
  • Like
  • 0

Hello!

 

I need some guidance on writing a controller extension and displaying it in VisualForce. I’ve been searching the forums and documentation, but can’t seem to wrap my head around how to get this to work. Here are the details…

 

I have the following custom object hierarchy for which I need to display data in one section of the parent object layout (Order)...

 

Order (Master of Shipping_Location)

     |

      --------> Shipping_Location (Detail of Order, An Order can have multiple Shipping_Locations)

                         |

                          --------> Item (Lookup Relationship with Shipping_Locations, A Shipping_Location can have multiple Items)

 

So, an example of what the data might look like for one Order object is this...

------------------------------------------------------------

Order Number: 2000

 

            Shipping Location: Seattle, Wa

                        Item 1: Red Ball

                        Item 2: Green Ball

                        Item 3: Yellow Ball

 

            Shipping Location: Cleveland, OH

Item 1: Yellow Ball

Item 2: Pink Ball

------------------------------------------------------------

 

I am able to display the Order and Shipping_Location data without issue using only a VisualForce Page (I am displaying the Shipping_Location data in a repeat tag). The issue that I cannot figure out is how to best display the Item details for each Shipping_Location, understanding that each Item is mapped to the current Shipping_Location’s unique Id.


I believe that the use of a controller extension is my answer, but I’m sketchy at figuring out the syntax and how to link it to my VF page (I only want to display the data – no form fields etc.) Another tricky part for me has been that I need to somehow pass the current Shipping_Location unique Id as a parameter so that when I query the Item object, that I am retrieving only those Items linked to the current Shipping_Location object.

 

Can someone please guide me to an example that closely matches mine (access to data two levels deep) or show me some controller and VF code that I can use to get started? I’m very new to this. Thanks for your help in advance!

  • October 23, 2009
  • Like
  • 0

Hello - I cannot figure out which URL to use for the Apex Explorer Endpoint. Upon install, the Endpoint defaulted to https://www.salesforce.com/services/Soap/u/8.0. I then ran into the "no semi joins allowed" error and found on the message boards that I need to update the API version. So, I've tried updating (both the Endpoint and Serv. URL) to all of the following, but get login failure, or cryptic pop-up error messages, or Apex Explorer crashes altogether! Can someone please tell me how to figure out what the Enpoint URL should be? FYI - I'm using https://www.salesforce.com/services/Soap/c/17.0 for my API operations and it works fine...

 

https://www.salesforce.com/services/Soap/u/17.0  (cryptic pop-up errors)

https://test.salesforce.com/services/Soap/c/17.0    (login failure message)

https://login.salesforce.com/services/Soap/c/17.0   (crashes and closes the application!)

 

Thanks!!!

  • October 22, 2009
  • Like
  • 0

Hi,

 

I have a Master-Detail relationship defined between object A (Master) and object B (Detail/Child). Creating this relationship forced the requirement of a value for object B's field that maps to object A. In the Salesforce UI, when I manually link an object A record to an object B record, the mapping field is a *standard* object A field (a unique id field that Salesforce creates). When I try to synchronize these records in my integration using the API, I run into an error stating that a value is required for the mapping field of object B. My problem is that I don't know how to obtain the value that I need from that standard field since it doesn't show up for the API object's available fields. What can I do?

 

Thanks in advance!

 

  • October 21, 2009
  • Like
  • 0

Hello!

 

I am trying to execute, what I believe is a very simple SOQL query with a Date comparison through the API "Binding.Query" method, but I continue to get the following error message. Any help is very much appreciated!

 

The Query:

------------------------------

SELECT Id, Company_ID__c, Last_Modified_Date__c, Last_Sync__c

FROM Account__c WHERE ((Company_Id__c = null) OR (Last_Sync__c = null) OR (Last_Sync__c < Last_Modified_Date__c)) 

 

The Error Message:

-----------------------------
System.Web.Services.Protocols.SoapException: MALFORMED_QUERY: 
(Last_Sync__c &lt; Last_Modified_Date__c))
^
ERROR at Row:7:Column:79
unexpected token: 'Last_Modified_Date__c'
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Syncer.sforce.SforceService.query(String queryString) in ...\SalesforceWebService\Syncer\Web References\sforce\Reference.cs:line 1077
at Syncer.SforceAPI.Query(String objectType, Int32 objectId) in ...\SalesforceWebService\Syncer\SforceAPI.cs:line 226
at Syncer.Customer_Salesforce.GetUnsyncedCustomers(Int32 companyId) in ...\SalesforceWebService\Syncer\Customer.cs:line 617
at SalesforceWebService.Service1.GetUnsyncedCustomersFromSalesforce(Int32 companyId) in ...\SalesforceWebService\SalesforceWebService\Service1.asmx.cs:line 94

 

 

 

 

 

 

  • October 20, 2009
  • Like
  • 0

Hello,

 

I have added a section to the Account Detail Page that points to a VisualForce Page. From the VF Page I have a button that the user needs to click and after some operations I want the current page to redirect to a Contact Page. This is working, but the new page gets loaded into the small section on the Account Detail page instead of the full window. How can I reload the entire window?

 

Here's the code at the bottom of my Apex method that gets called when the button is clicked...

 

 

PageReference newContactPage = new ApexPages.StandardController(newContactRec).view(); newContactPage.setRedirect(true); return newContactPage;

 

Thanks!

 

 

 

 

  • November 21, 2009
  • Like
  • 0

Hello,

 

I need some guidance on how to pass an integer parameter from a VisualForce Page into a controller extension function (or constructor?). Thank you for any help you can provide as I feel SO close! :)

 

Here's the VisualForce Code:

-------------------------------

<apex:page standardController="Order_Details__c" extensions="OrderItemController">

      <apex:pageBlock>

          <table border="0" width="100%">

          <apex:repeat var="cx" value="{!Order_Details__c.Shipping_Locations2__r}">

              <tr><td><b>Ship To:</b></td></tr>

              <tr><td><b>{!cx.Last_Name__c}, {!cx.First_Name__c} ({!cx.Address_Type__c})</b></td></tr>

              <tr><td>{!cx.Street__c}</td></tr>

              <tr><td>{!cx.City__c}, {!cx.State_Province__c} {!cx.Postal_Code__c}</td></tr>

              <tr><td>Phone: {!cx.Phone__c}</td></tr>

              <tr><td>Email: {!cx.Email__c}</td></tr>

              <tr><td>&nbsp;</td></tr>

             

              <tr><td>

             <!-- Next line/area is where I need to pass the current value of {!cx.Shipping_Location_Id__c} to either the getOrderItemList function or set it in another function. How do I do this? -->

                  <apex:pageBlockTable value="{!OrderItemList}" var="item">

                     <apex:column  value="{!item.SKU__c}"/>

                     <apex:column value="{!item.Name__c}"/>

                     <apex:column value="{!item.Quantity__c}"/>

                     <apex:column value="{!item.Weight__c}"/>

                     <apex:column value="{!item.Supplier__c}"/>

                     <apex:column value="{!item.Dropship__c}"/>

                     <apex:column value="{!item.Status__c}"/>

                     <apex:column value="{!item.Price__c}"/>

                     <apex:column value="{!item.Ext_Price__c}"/>

                  </apex:pageBlockTable>

              </td></tr>

             

              <tr><td>&nbsp;</td><td></td><td></td></tr>

          </apex:repeat>

          </table>

      </apex:pageBlock>

</apex:page>

 

 

Here's the Controller Function:

-------------------------------

public class OrderItemController {

 

    public OrderItemController(ApexPages.StandardController controller) { }

   

    public Order_Item__c[] getOrderItemList()

    {

          return [select Order_Item_ID__c, Shipping_Location_Id__c, SKU__c, Image_Path__c,

              Name__c, Quantity__c, Weight__c, Supplier__c, Dropship__c, Shipping_Location_Name__c,

Status__c, Price__c, Ext_Price__c from Order_Item__c where Shipping_Location_Id__c = 5395]; // ß- this needs to come from a variable/parameter that is passed from the VF Page

    }

}

 

 

  • October 23, 2009
  • Like
  • 0

Hello!

 

I need some guidance on writing a controller extension and displaying it in VisualForce. I’ve been searching the forums and documentation, but can’t seem to wrap my head around how to get this to work. Here are the details…

 

I have the following custom object hierarchy for which I need to display data in one section of the parent object layout (Order)...

 

Order (Master of Shipping_Location)

     |

      --------> Shipping_Location (Detail of Order, An Order can have multiple Shipping_Locations)

                         |

                          --------> Item (Lookup Relationship with Shipping_Locations, A Shipping_Location can have multiple Items)

 

So, an example of what the data might look like for one Order object is this...

------------------------------------------------------------

Order Number: 2000

 

            Shipping Location: Seattle, Wa

                        Item 1: Red Ball

                        Item 2: Green Ball

                        Item 3: Yellow Ball

 

            Shipping Location: Cleveland, OH

Item 1: Yellow Ball

Item 2: Pink Ball

------------------------------------------------------------

 

I am able to display the Order and Shipping_Location data without issue using only a VisualForce Page (I am displaying the Shipping_Location data in a repeat tag). The issue that I cannot figure out is how to best display the Item details for each Shipping_Location, understanding that each Item is mapped to the current Shipping_Location’s unique Id.


I believe that the use of a controller extension is my answer, but I’m sketchy at figuring out the syntax and how to link it to my VF page (I only want to display the data – no form fields etc.) Another tricky part for me has been that I need to somehow pass the current Shipping_Location unique Id as a parameter so that when I query the Item object, that I am retrieving only those Items linked to the current Shipping_Location object.

 

Can someone please guide me to an example that closely matches mine (access to data two levels deep) or show me some controller and VF code that I can use to get started? I’m very new to this. Thanks for your help in advance!

  • October 23, 2009
  • Like
  • 0

Hello - I cannot figure out which URL to use for the Apex Explorer Endpoint. Upon install, the Endpoint defaulted to https://www.salesforce.com/services/Soap/u/8.0. I then ran into the "no semi joins allowed" error and found on the message boards that I need to update the API version. So, I've tried updating (both the Endpoint and Serv. URL) to all of the following, but get login failure, or cryptic pop-up error messages, or Apex Explorer crashes altogether! Can someone please tell me how to figure out what the Enpoint URL should be? FYI - I'm using https://www.salesforce.com/services/Soap/c/17.0 for my API operations and it works fine...

 

https://www.salesforce.com/services/Soap/u/17.0  (cryptic pop-up errors)

https://test.salesforce.com/services/Soap/c/17.0    (login failure message)

https://login.salesforce.com/services/Soap/c/17.0   (crashes and closes the application!)

 

Thanks!!!

  • October 22, 2009
  • Like
  • 0

Hi,

 

I have a Master-Detail relationship defined between object A (Master) and object B (Detail/Child). Creating this relationship forced the requirement of a value for object B's field that maps to object A. In the Salesforce UI, when I manually link an object A record to an object B record, the mapping field is a *standard* object A field (a unique id field that Salesforce creates). When I try to synchronize these records in my integration using the API, I run into an error stating that a value is required for the mapping field of object B. My problem is that I don't know how to obtain the value that I need from that standard field since it doesn't show up for the API object's available fields. What can I do?

 

Thanks in advance!

 

  • October 21, 2009
  • Like
  • 0

Is there any indicator in APEX of what *type* of update took place, e.g. manually through the browser vs. through the API? 

 

There's a set of checkboxes I want to set/unset if a record is created manually vs. being created through an API or Data Loader.