• dhoechst
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 11
    Replies

Hello! Gurus,

 

I saw the solution to similar issue on different thread, but did not help me much.

So I am trying to run aggregate funstion, and I get this error "aggregate query not allowed with this api version" both in Eclipse and Apex Explorer, how do I change the the API version number??

 

I see we can do that for Class/Trigger via the xml file, but just could not do it for +salesforce.schema file in Eclipse.

Apex explorer, I did not see any options that allows me to change the the version number.

 

Apart from force.com ide and apex explorer, are you aware of other tools I can use to querry SOQL??

 

Thanks in asvance.

Mitesh

How can I process a checkbox field in apex code (not with DeveloperForce)?  In my trigger I want to see if the field is checked and after processing it, uncheck the field.  I cannot find examples of this.  I want my user to check a checkbox of accounts to be processed, this will invoke the bulk trigger.  Can anyone help?  I can't find any examples after much searching.

  • August 31, 2010
  • Like
  • 0

I've got a workflow that runs when a boolean field is set to true. The workflow sends an outbound message and does a field update to the boolean to false.

 

I've got a trigger that updates that boolean field to true. My problem is that when I write the test, it fails in the assertion because the boolean has been reset to false by the workflow. How can I do an assertion here? I'm good on code coverage and I know that the trigger is working, but I really want someway to do the assertion. Does anybody have any ideas?

We can't post to our Facebook page with the Salesforce for Facebook app. We get a message "Argument cannot be be null." It works if we post to Twitter. Here's a screenshot of what we are seeing:

When trying to Grant Access to our Facebook page, we get the following error: sf4twitter.JSONObject.JSONException: Expected a , or } after selecting the page we want to link. Any ideas on what is going on?

I have the following SOQL used in a VisualForce page:

 

"Select c.Product__r.PA_Product_Class__c productClass, sum(c.Rolling_12_Current__c) sales from PA_Customer_History__c c where c.Account__c = '{!account.Id}' group by c.Product__r.PA_Product_Class__c"

 

The field Rolling_12_Current__c is a currency field and the records I am querying are all in USD. Our corporate currency is EUR. My user is set up with a currency of USD. When the query is run, the sum() returns back a converted value in EUR instead of USD. According to the documentation at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_currency_fields.htm, this shouldn't happen: "Currency data is converted to the user's locale and then processed by the aggregate function."

 

My user's currency is in USD, so it should display it properly in USD. As a temporary work around, I've changed our exchange rate to 1. Can someone please let me know how I can get the SOQL aggregate to return the values in my user's currency? I tried using convertCurrency, but I get a malformed query error.

I have the following SOQL used in a VisualForce page:

 

"Select c.Product__r.PA_Product_Class__c productClass, sum(c.Rolling_12_Current__c) sales from PA_Customer_History__c c where c.Account__c = '{!account.Id}' group by c.Product__r.PA_Product_Class__c"

 

The field Rolling_12_Current__c is a currency field and the records I am querying are all in USD. Our corporate currency is EUR. My user is set up with a currency of USD. When the query is run, the sum() returns back a converted value in EUR instead of USD. According to the documentation at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_currency_fields.htm, this shouldn't happen: "Currency data is converted to the user's locale and then processed by the aggregate function."

 

My user's currency is in USD, so it should display it properly in USD. As a temporary work around, I've changed our exchange rate to 1. Can someone please let me know how I can get the SOQL aggregate to return the values in my user's currency? I tried using convertCurrency, but I get a malformed query error.

I've got a workflow that runs when a boolean field is set to true. The workflow sends an outbound message and does a field update to the boolean to false.

 

I've got a trigger that updates that boolean field to true. My problem is that when I write the test, it fails in the assertion because the boolean has been reset to false by the workflow. How can I do an assertion here? I'm good on code coverage and I know that the trigger is working, but I really want someway to do the assertion. Does anybody have any ideas?

When trying to Grant Access to our Facebook page, we get the following error: sf4twitter.JSONObject.JSONException: Expected a , or } after selecting the page we want to link. Any ideas on what is going on?

Hey, I'm trying to traverse relationships in Javascript, and the dot notation is not working in Javascript. Can you please help me access the name? I have written my own Javascript Remoting class that handles the query and then returns the results.

 

//Building the SOQL query to pass to the Javascript remoting class

var queryAcct = "SELECT id, Name, Owner.Name, Division__r.Name FROM Account ";
queryAcct += "WHERE Owner.name like '%{username}%'";
queryAcct += " ORDER BY Division__c ";
queryAcct += "Limit 5000";

 

//Fucntion that is called to query the account records, this then passes the results off to the next function that builds the table

function getaccts(){
var un = document.getElementById("username").value;
alert(queryAcct.replace("{username}",un));
RemotingToolkit.query(queryAcct.replace("{username}",un),function(result,event) {
        if (event.status) {
        handleAccts(result,$j('#acctresultsDiv'));
             } else {
                    alert('Remoting call failed');
                    }
        });
    }

 //Handles the Array that is returned from the query, then using Jquery builds the table and injects the HTML in to the div.

function handleAccts(records,tableObject) {
            var tableString ='<table border="1">';
                tableString+='<th>Owner</th><th>Company</th><th>Division</th>';
                $j.each(records, function(index,record) {
                tableString += '<tr><td> ' + record.Owner.Name + '</td><td>' + record.Name+''+ '</td><td>' + record.Division__r.Name+'';
                });
                tableString += '</td></tr></table>';
                tableObject.html(tableString);
                }

 I can pass in record.Division__c and it runs, when I try to pass in record.Division__r.Name it erros out. What can I do to access the name of the related object? What is really wierd is that "record.Owner.Name" works and returns the name of the owner, not the ID, but Division__r.Name throws an error.

 

Thanks!

 

-Chris

  • July 18, 2011
  • Like
  • 0

Hi all,

 

I am trying to move a Trigger into Production but I am getting a 0% coverage when I validate it through Eclipse/Force.com.  I have 100% coverage when I run all tests in the sandbox.

 

The trigger will move the owner of an event to match the new lead owner once the lead is moved from a lead queue owner.

 

Here is the trigger and class.  I already received help from the discussion board on the trigger, thanks again in advance.

 

Any suggestions?

 

 

**** Trigger ****

trigger ownerupdate on Lead (after Update) {

List<Event> aplist = new List<Event>();

for(Lead t : Trigger.new){

IF(
(t.LeadSource == 'Telemarketing'
    && t.OwnerId != '00G30000001iNeKEAU' 
     && t.OwnerId != '00G30000001iNtxEAE'
      && t.OwnerId != '00G30000001uiO5'
       && t.OwnerId != '00G30000001iCwM'
        && t.OwnerId != '00G30000001uh70'
         && t.OwnerId != '00G30000001iNt5EAE'
          && t.OwnerId != '00G30000001ui8wEAA'
           && t.OwnerId != '00G30000001iNuC'
            && t.OwnerId != '00G30000001iNsL'
             && t.OwnerId != '00G30000001iNvZ'
              && t.OwnerId != '00G30000001jtEi'
               && t.OwnerId != '00G30000001tiXR'
                && t.OwnerId != '00G30000001ui8w'
                 && t.OwnerId != '00G30000001iNt5'
))

{List<Event> aps = [Select WhoId, Whatid, OwnerId from Event where WhoId = :t.Id];
   for (Event ap : aps)
   {       
      ap.OwnerId = t.OwnerId;

      aplist.add( ap );
   }

}}
update aplist;
}
trigger ownerupdate on Lead (after Update) {
    && t.OwnerId != '00G30000001iNeKEAU' 
**** Class Test Method **** public class ownerupdate { static testMethod void T1() { Id lId; Id eId; //CREATE 1 LEAD Lead l = new Lead(); l.LeadSource = 'Telemarketing'; l.lastname = 'Doe'; l.company = 'Test Company'; l.ownerId = '00530000003IFwV'; l.status = 'Open'; l.market__c = 'Atlanta'; Database.insert(l); lId = l.Id; //CREATE 2 Event Event e = New Event (); e.DurationInMinutes = 60; e.ActivityDateTime = date.today(); e.ownerId = l.ownerId; e.WhoId = l.Id; Database.SaveResult result = Database.insert(e); eId = e.Id; update e; {List<Lead> aps = [Select Leadsource, owner_convert_queue__c, id, OwnerId from Lead where id = :e.whoId]; system.debug('@@@apo=' + aps); } }}

 

Alex

 

  • September 01, 2010
  • Like
  • 0

Hello! Gurus,

 

I saw the solution to similar issue on different thread, but did not help me much.

So I am trying to run aggregate funstion, and I get this error "aggregate query not allowed with this api version" both in Eclipse and Apex Explorer, how do I change the the API version number??

 

I see we can do that for Class/Trigger via the xml file, but just could not do it for +salesforce.schema file in Eclipse.

Apex explorer, I did not see any options that allows me to change the the version number.

 

Apart from force.com ide and apex explorer, are you aware of other tools I can use to querry SOQL??

 

Thanks in asvance.

Mitesh

How can I process a checkbox field in apex code (not with DeveloperForce)?  In my trigger I want to see if the field is checked and after processing it, uncheck the field.  I cannot find examples of this.  I want my user to check a checkbox of accounts to be processed, this will invoke the bulk trigger.  Can anyone help?  I can't find any examples after much searching.

  • August 31, 2010
  • Like
  • 0
Ok, I have a workflow rule that sends out an email regarding contracts that are due to expire. This rules is based on a custom formula field in the contracts object. The formula calculates the remaining months for a contract. How can I get this rule to trigger even though the record is not physically edited or created. What we have to do right now is wipe out all the contracts every night and rebuild them with a data push from our servers and that will trigger the rule to look at each record and it's respective "Month's remaining" field value and trigger the email or not. Has anybody encountered this problem and be able to solve it wiht an apex trigger? I have not prior experianc eusing or implemnting APex triggers so please keep that in mind when you point me in the right direction. Thank you very much Anthony
  • August 30, 2010
  • Like
  • 0

I have the following SOQL used in a VisualForce page:

 

"Select c.Product__r.PA_Product_Class__c productClass, sum(c.Rolling_12_Current__c) sales from PA_Customer_History__c c where c.Account__c = '{!account.Id}' group by c.Product__r.PA_Product_Class__c"

 

The field Rolling_12_Current__c is a currency field and the records I am querying are all in USD. Our corporate currency is EUR. My user is set up with a currency of USD. When the query is run, the sum() returns back a converted value in EUR instead of USD. According to the documentation at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_currency_fields.htm, this shouldn't happen: "Currency data is converted to the user's locale and then processed by the aggregate function."

 

My user's currency is in USD, so it should display it properly in USD. As a temporary work around, I've changed our exchange rate to 1. Can someone please let me know how I can get the SOQL aggregate to return the values in my user's currency? I tried using convertCurrency, but I get a malformed query error.