• kcoste
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

I'm running eclipse 3.4.2. When I open the Schema Browser and try to run this simple aggregate query:

 

SELECT FirstName, LastName FROM Contact GROUP BY FirstName, LastName

 

I get the error "MALFORMED QUERY - Aggregate query not allowed with this Api version".

 

When I create a new Apex Class, I can only select version 16.0.

 

How can I use the latest Api (18.0), so that I can use aggregates?

 

Thanks,

--Ken

  • March 15, 2010
  • Like
  • 0

I have created a custom object, named VAR (Value at Risk). It is, and must be, a singleton object. There must be one and only one VAR record in the system. It makes absolutely no sense to have more than one VAR record. Having no VAR record is equally ridiculous.

 

Many other objects must have access this systemwide singleton value. Of course, it needs to be easily updated by authorized users.

 

The VAR record's value is tracked via "Set History Tracking." Each time VAR changes, Salesforce's Track History shows when it was changed, who changed it, and what the change was, leaving a perfect audit trail on the VAR record -- exactly per requirements.

 

I was able to make this work very easily in the sandbox, but I can not deploy it in Production via Eclipse because Salesforce insists on running both the insertVAR and deleteVAR triggers before allowing the deployment to succeed. And, given the triggers, of course it fails, and therefore code coverage is zero for those triggers, and I'm out of luck....

 

Here are the two trivial triggers:

 

trigger insertVAR on CES_VAR__c (before insert) {

Trigger.new[0].addError('\r\nThere can only be one VaR record! To change VaR, click the Edit button.');

}

 

trigger deleteVAR on CES_VAR__c (before delete) {

Trigger.old[0].addError('Can not delete the VAR record! To change VaR, click the Edit button.');

}

 

How can I get this to deploy? Is there some way to fool Salesforce into accepting this? Is there a singleton pattern in Salesforce that I'm not aware of?

 

Has anyone been able to get this (rather standard design pattern) to work on Salesforce?

 

Thank you very much for your time.

 

  • January 06, 2010
  • Like
  • 0


Hi, I created a controller, a component, and a plain text Visualforce email template for use in approval processes. Everything works fine except for line breaks in the emails.

 

It had proper line breaks until I added the <apex: outputText/> for formatting numbers and currency.

 

The controller, component and template are as follows:

 

public class MyController { private ID m_opportunityID; . . . public List<Terms__c> getTerms() { List<Terms__c> Terms = new List<Terms__c>(); Terms = [ Select field1__c, field2__c, field3__c From Terms__c Where Opportunity__c = :m_opportunityID ]; return Terms; } }

 

 

<apex:component access="global" controller="MyController" > <apex:attribute name="opportunityID" description="blah" type="ID" required="required" assignTo="{!opportunityID}"/> <apex:repeat value="{!Terms}" var="opp"> <apex:outputText escape="false" value="Display1: {0,number,#,###}, Display2: {1}, Display3: {2,number,currency}"> <apex:param value="{!opp.field1__c}" /> <apex:param value="{!opp.field2__c}" /> <apex:param value="{!opp.field3__c}" /> </apex:outputText> </apex:repeat> </apex:component>

 

 

<messaging:emailTemplate subject="Subject" recipientType="User" relatedToType="Contract"> <messaging:plainTextEmailBody > Please approve blah blah with the following terms: <c:MyComponent opportunityID="{!relatedTo.Opportunity__r.ID}"/> </messaging:plainTextEmailBody> </messaging:emailTemplate>

 

 

But no matter what I try, I get (at best):

 

Please approve the contract with the following terms:
Display1: 1000, Display2: 2009, Display3: $1.00Display1: 2000, Display2: 2010, Display3: $2.00

 

instead of

 

Please approve the contract with the following terms:

 

Display1: 100, Display2: 2009, Display3: $1,001.00
Display1: 200, Display2: 2010, Display3: $2,002.00

 

I've tried placing "\r\n" "%0D%0A", etc, everywhere -- in various formats -- to embed a cariage-return line-feed, both with escape="false" and escape="true" but nothing has any effect.

 

The requirements are plain text -- no HTML email.

 

What am I missing?

Thanks!

  • October 02, 2009
  • Like
  • 0

I'm running eclipse 3.4.2. When I open the Schema Browser and try to run this simple aggregate query:

 

SELECT FirstName, LastName FROM Contact GROUP BY FirstName, LastName

 

I get the error "MALFORMED QUERY - Aggregate query not allowed with this Api version".

 

When I create a new Apex Class, I can only select version 16.0.

 

How can I use the latest Api (18.0), so that I can use aggregates?

 

Thanks,

--Ken

  • March 15, 2010
  • Like
  • 0

I have created a custom object, named VAR (Value at Risk). It is, and must be, a singleton object. There must be one and only one VAR record in the system. It makes absolutely no sense to have more than one VAR record. Having no VAR record is equally ridiculous.

 

Many other objects must have access this systemwide singleton value. Of course, it needs to be easily updated by authorized users.

 

The VAR record's value is tracked via "Set History Tracking." Each time VAR changes, Salesforce's Track History shows when it was changed, who changed it, and what the change was, leaving a perfect audit trail on the VAR record -- exactly per requirements.

 

I was able to make this work very easily in the sandbox, but I can not deploy it in Production via Eclipse because Salesforce insists on running both the insertVAR and deleteVAR triggers before allowing the deployment to succeed. And, given the triggers, of course it fails, and therefore code coverage is zero for those triggers, and I'm out of luck....

 

Here are the two trivial triggers:

 

trigger insertVAR on CES_VAR__c (before insert) {

Trigger.new[0].addError('\r\nThere can only be one VaR record! To change VaR, click the Edit button.');

}

 

trigger deleteVAR on CES_VAR__c (before delete) {

Trigger.old[0].addError('Can not delete the VAR record! To change VaR, click the Edit button.');

}

 

How can I get this to deploy? Is there some way to fool Salesforce into accepting this? Is there a singleton pattern in Salesforce that I'm not aware of?

 

Has anyone been able to get this (rather standard design pattern) to work on Salesforce?

 

Thank you very much for your time.

 

  • January 06, 2010
  • Like
  • 0


Hi, I created a controller, a component, and a plain text Visualforce email template for use in approval processes. Everything works fine except for line breaks in the emails.

 

It had proper line breaks until I added the <apex: outputText/> for formatting numbers and currency.

 

The controller, component and template are as follows:

 

public class MyController { private ID m_opportunityID; . . . public List<Terms__c> getTerms() { List<Terms__c> Terms = new List<Terms__c>(); Terms = [ Select field1__c, field2__c, field3__c From Terms__c Where Opportunity__c = :m_opportunityID ]; return Terms; } }

 

 

<apex:component access="global" controller="MyController" > <apex:attribute name="opportunityID" description="blah" type="ID" required="required" assignTo="{!opportunityID}"/> <apex:repeat value="{!Terms}" var="opp"> <apex:outputText escape="false" value="Display1: {0,number,#,###}, Display2: {1}, Display3: {2,number,currency}"> <apex:param value="{!opp.field1__c}" /> <apex:param value="{!opp.field2__c}" /> <apex:param value="{!opp.field3__c}" /> </apex:outputText> </apex:repeat> </apex:component>

 

 

<messaging:emailTemplate subject="Subject" recipientType="User" relatedToType="Contract"> <messaging:plainTextEmailBody > Please approve blah blah with the following terms: <c:MyComponent opportunityID="{!relatedTo.Opportunity__r.ID}"/> </messaging:plainTextEmailBody> </messaging:emailTemplate>

 

 

But no matter what I try, I get (at best):

 

Please approve the contract with the following terms:
Display1: 1000, Display2: 2009, Display3: $1.00Display1: 2000, Display2: 2010, Display3: $2.00

 

instead of

 

Please approve the contract with the following terms:

 

Display1: 100, Display2: 2009, Display3: $1,001.00
Display1: 200, Display2: 2010, Display3: $2,002.00

 

I've tried placing "\r\n" "%0D%0A", etc, everywhere -- in various formats -- to embed a cariage-return line-feed, both with escape="false" and escape="true" but nothing has any effect.

 

The requirements are plain text -- no HTML email.

 

What am I missing?

Thanks!

  • October 02, 2009
  • Like
  • 0