• jyg
  • NEWBIE
  • -1 Points
  • Member since 2011

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

Here's a snippet from my singleton class.  Its basically serves an Order__c record to the client controllers that need it.  Controller will call "OrderService.getInstance()...".  Initial instantiation is guaranteed to have an Order__c record that is saved in Salesforce.  However, in the *not-a-constructor*  static getInstance() method I get that darn "System.LimitExpcetion: DML currently not allowed" error.  Any ideas?   FWIW, all my Components have allowDML="true".

 

thanks,

 

Jason Gabler

 

public class OrderService {

 private static OrderService self;
 private final static String orderIdCookieName = 'someCompanyOrderId';
 private Order__c order;

 private OrderService() {
   Cookie c = ApexPages.currentPage().getCookies().get(orderIdCookieName);
   Id orderId = (c == null) ? null : c.getValue();
   if (orderId != null) {
     this.retrieveOrder(orderId);  // does nothing if a record cannot be found in Salesforce
   }
   if (this.order == null) {
     this.order = new Order__c();  // just make a new record, can't to DML here so don't try to insert
   }
 }

// Controllers will call OrderService.getInstance() to get the singleton isntance of this service public static OrderService getInstance() { if (self == null) { self = new OrderService(); // create the singleton, we can see from above we are guarnateed upsert self.order; // **** "DML currently not allow", why not?! } return self; } ... }

 

 

 

 

  • December 24, 2012
  • Like
  • 0

My customer of mine has about 50 Products, each with at least 3 different images per product, and each images can have a different image size within 3 places on on her Force.com Site.  That means she must create 450 images, upload 450 images into Rich Text Fields or use Documents or Static Resources and enter 450 fields on Products that contain URLs to those records  

 

There must be an easier way to accomplish this.  Does anyone have a pattern?

 

thanks,

 

Jason Gabler


  • July 13, 2012
  • Like
  • 0

I have a page on a Site which is displayed using composition within a template.  I'd like to click on an actionButton within the page and cause an outputPanel within the template to rerender.  However, it seems that actionButtons within pages or components are not aware of other re-renderable items outside themselves.

 

Is this true?  If not, how can you do this?

 

thanks,

 

jyg

  • July 06, 2012
  • Like
  • 0

I've read through at least 20 posts about this issue, and one or two actually have working examples that seem to match what I'm attemping, but it doesnt work for me.  Please take a look and tell me what I'm not getting right, thanks.  For what its worth, I'm getting no luck with action Function either.

 

I expect that when I click on "I WANT ITX",  the varible "poid" in the controller is set to "123" and then the function "addToCard() gets fired off with access to the new value of "poid".  However, "poid" is always null.

 

Page snippet

<apex:outputPanel styleClass="want">
  I WANT ITX
  <apex:actionSupport event="onclick" action="{!addToCart}">
    <apex:param name="poid" assignTo="{!poid}" value="123"/>
  </apex:actionSupport>
</apex:outputPanel>

 

Controller snippet

// apex:param for apex:actionSupport
public String poid { get; set; } 

// function called from apex:actionSupport
public PageReference addToCart() {
  System.debug('===== POID: ['+((poid==null)?'null':poid)+']');
  .
  .
  .
}

 

 

 

  • December 25, 2011
  • Like
  • 0

About 15 bullet points down,  https://na11.salesforce.com/help/doc/en/fields_using_rich_text_area.htm it seems to imply that you can use rich text fields in formula fields.  However when I attempt to create my formula field and open the formula editor, all fields but the rich text fields are available.  The only thing that might make a difference is that the rich text fields I am attempting to reference are not in the initial object receiving the formula field, but something pointing to by the initial object.

 

Can someone shed some light on this for me?  Thanks.

 

jyg

  • December 20, 2011
  • Like
  • 0

Here's a snippet from my singleton class.  Its basically serves an Order__c record to the client controllers that need it.  Controller will call "OrderService.getInstance()...".  Initial instantiation is guaranteed to have an Order__c record that is saved in Salesforce.  However, in the *not-a-constructor*  static getInstance() method I get that darn "System.LimitExpcetion: DML currently not allowed" error.  Any ideas?   FWIW, all my Components have allowDML="true".

 

thanks,

 

Jason Gabler

 

public class OrderService {

 private static OrderService self;
 private final static String orderIdCookieName = 'someCompanyOrderId';
 private Order__c order;

 private OrderService() {
   Cookie c = ApexPages.currentPage().getCookies().get(orderIdCookieName);
   Id orderId = (c == null) ? null : c.getValue();
   if (orderId != null) {
     this.retrieveOrder(orderId);  // does nothing if a record cannot be found in Salesforce
   }
   if (this.order == null) {
     this.order = new Order__c();  // just make a new record, can't to DML here so don't try to insert
   }
 }

// Controllers will call OrderService.getInstance() to get the singleton isntance of this service public static OrderService getInstance() { if (self == null) { self = new OrderService(); // create the singleton, we can see from above we are guarnateed upsert self.order; // **** "DML currently not allow", why not?! } return self; } ... }

 

 

 

 

  • December 24, 2012
  • Like
  • 0

My customer of mine has about 50 Products, each with at least 3 different images per product, and each images can have a different image size within 3 places on on her Force.com Site.  That means she must create 450 images, upload 450 images into Rich Text Fields or use Documents or Static Resources and enter 450 fields on Products that contain URLs to those records  

 

There must be an easier way to accomplish this.  Does anyone have a pattern?

 

thanks,

 

Jason Gabler


  • July 13, 2012
  • Like
  • 0

I have a page on a Site which is displayed using composition within a template.  I'd like to click on an actionButton within the page and cause an outputPanel within the template to rerender.  However, it seems that actionButtons within pages or components are not aware of other re-renderable items outside themselves.

 

Is this true?  If not, how can you do this?

 

thanks,

 

jyg

  • July 06, 2012
  • Like
  • 0

I've read through at least 20 posts about this issue, and one or two actually have working examples that seem to match what I'm attemping, but it doesnt work for me.  Please take a look and tell me what I'm not getting right, thanks.  For what its worth, I'm getting no luck with action Function either.

 

I expect that when I click on "I WANT ITX",  the varible "poid" in the controller is set to "123" and then the function "addToCard() gets fired off with access to the new value of "poid".  However, "poid" is always null.

 

Page snippet

<apex:outputPanel styleClass="want">
  I WANT ITX
  <apex:actionSupport event="onclick" action="{!addToCart}">
    <apex:param name="poid" assignTo="{!poid}" value="123"/>
  </apex:actionSupport>
</apex:outputPanel>

 

Controller snippet

// apex:param for apex:actionSupport
public String poid { get; set; } 

// function called from apex:actionSupport
public PageReference addToCart() {
  System.debug('===== POID: ['+((poid==null)?'null':poid)+']');
  .
  .
  .
}

 

 

 

  • December 25, 2011
  • Like
  • 0

About 15 bullet points down,  https://na11.salesforce.com/help/doc/en/fields_using_rich_text_area.htm it seems to imply that you can use rich text fields in formula fields.  However when I attempt to create my formula field and open the formula editor, all fields but the rich text fields are available.  The only thing that might make a difference is that the rich text fields I am attempting to reference are not in the initial object receiving the formula field, but something pointing to by the initial object.

 

Can someone shed some light on this for me?  Thanks.

 

jyg

  • December 20, 2011
  • Like
  • 0

Hi,

 

I am i have a created a custom object and am trying to make a master-detail relationship with the object Product. The problem is when I select Master-Detail the Product object does not show up in the drop down list. Does this mean that I can not create a Master Detail relation ship keeping the Product as the master or is there some settings to be changed to get this done.

 

Thanks

KD 

  • May 20, 2009
  • Like
  • 0