• Christopher_J
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 18
    Replies
I'm new to Apex and trying to understand how to accomplish a fairly simple task in Batch Apex.  I'm trying to sum a field from a group of records and write it to a field on every account.  My code looks is below.  The bolded part is throwing the error Compile Error: Illegal assignment from LIST<AggregateResult> to Decimal at line 15 column 9. I understand what the error is but I'm not sure how to return the result correctly in this context.  

Thanks for any help you can provide!

global class CalculateACPY implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'Select Id, Name, Active_Contract_Amount__c from Account';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Account> scope)
    {
        for(Account a : scope)
        {
       a.Active_Contracts_Per_Year__c = [select sum(amount_per_year__c) from contract where EndDate < TODAY and id =:a.id];
        }
        update scope;
    }
    global void finish(Database.BatchableContext BC)
    {  
    }
}
Hi All,

I've created two trigger flows that run when records are inserted into a Custom Object I've created.  I've tested them with the Apex Data Loader and they work great *IF* I limit the batch size to 10.  If I run it at 200, everything fails saying the flow couldn't be launched.

Eventually this will be part of a 3rd party integration that is being developed.  I'm wondering if there is a way with either the Bulk API or the normal API to define the batch size as 10 records at a time no matter what record set is being uploaded?  Or will the 3rd party devs have handle all of that on their end and divide the record set up?

Thanks,

Chris
Hi All,

Can someone let me know if I'm on the right track with force.com sites for this use?  I've used force.com sites to turn visual flows public facing with great success.  It allows us to capture data directly into Salesforce with minimal effort.

Now I'd like to allow our Partners who create Opportunities with a webform on our website to be able to see the status of those Opportunities, the line items, and a list from a custom object I call Shipped Products.  So essentially there would be a page that asks for their Unique ID which could be on their account record, and then would bring back a list of their Opportunities that they could click on and see some detail.  Nothing would be editable.

Can this be accomplished with a force.com site?  It seems fairly straightforward and I can envision the queries I need to get the data, but I'm getting stuck on how the user would move between the three pages (authentication, opp list, opp detail).  

Would someone be so kind as to give some guidance of how to get started?

Thanks!

Chris
Has anyone run into this issue?  I'm creating a lead with a Visual Flow form but the lead assignment rule doesn't assign it to Salesperson.

Help!

Chris

Hi Experts,

 

I'm trying to sort this one out.  Basically I'm able to both sum, query, and report the total price of line items with a certain product name, but I'd now like to filter that list by whether or not a different product is also a line item in the opportunity.  I'm not seeing an easy way to do it in reports on SOQL.  A nested query maybe?

 

Any ideas?

Hi All,

 

Subject sort of says it all.  I have a public facing Visual Flow that creates a lead.  I return the new lead id and would like to use it to create the lead as a Campaign Member.  The flow works fine running from a  Marketing User enabled account but the Force.com Site public facing version uses the guest user license which I apparently can't allow to create Campaign Members.

 

Does anyone have a clue how to get this done?

 

Thanks!

 

Chris

Hi All,

 

Still very new to apex and visualforce so back with basic questions that I can't find the answers to.  Thanks in advance for any help that can be offered.

 

I'm having an issue with a SOQL query in my extension controller.  Basically what I'm trying to do is a create a list of custom object records (pricing_exception__c) in an embedded visualforce page on the opportunity layout.

 

I have the section created fine in visualforce but I can't get the list to come back correctly.  My code is as follows.  The ????????? needs to essentially be account.name of the opportunity page I'm on but nothing I'm trying is producing a result.  I'm starting to wonder if it's not possible to do this with an embedded vf page in the opportunity layout?

 

public class retrievePEList {

public retrievePEList(ApexPages.StandardController controller) {

}

 

public List<Pricing_Exception__c> getExceptions() {
return [SELECT Name, Pricing_Exception__c.Account_Name__c, End_User_Account_Name__c, PE_Status__c, Exception_End_Date__c FROM Pricing_Exception__c
WHERE PE_Status__c = 'Approved' and Exception_End_Date__c > TODAY and ???????????

}
}

Hi All,

 

I'm really enjoying the Salesforce platform but am very new to coding and have run into a few problems.

 

I have a custom object account_activity__c, that has several checkboxes on it that will be used to code interactions with our customers.  It also has a category field as well as a lookup relationship to another custom object (Project_Manager) where the interactions (account_activities) will be "housed".  

 

What I'm trying to do is create a visualforce page that will display a count of the "true" checkboxes for each question in each account_activity that is connected to the Project_Manager, grouped by category.  I'm stuck on multiple fronts.

 

1.  I'm trying to load this in a tab on the visualforce page I created to replace the detail view of the account_activity object.  I have a custom controller made and a visualforce page I'm loading in the tabbed interface.  Is there a simple way to pass the ID of the current record into Apex so I can use it in the SOQL query to filter account_activity by the lookup relationship ID?

 

My query right now is this and I need to somehow insert the ID of the page I'm loading in the where.  

 

Select category__c, Count(id) from Account_Activity__c Where Project_Manager__r.Id='a18c0000000LU8V' and question1__c=true group by rollup
(category__c)

 

2.  This query essentially gives me one row of data for my end product but it won't return a zero if a null is returned for any given category.  Is there a way to overcome this?  

 

I'm sure there are a million better ways to do what I'm trying to do, but I'm so new to coding I'm just trying to get it done any way I can.

 

Thanks!

 

Chris

Hi All,

Can someone let me know if I'm on the right track with force.com sites for this use?  I've used force.com sites to turn visual flows public facing with great success.  It allows us to capture data directly into Salesforce with minimal effort.

Now I'd like to allow our Partners who create Opportunities with a webform on our website to be able to see the status of those Opportunities, the line items, and a list from a custom object I call Shipped Products.  So essentially there would be a page that asks for their Unique ID which could be on their account record, and then would bring back a list of their Opportunities that they could click on and see some detail.  Nothing would be editable.

Can this be accomplished with a force.com site?  It seems fairly straightforward and I can envision the queries I need to get the data, but I'm getting stuck on how the user would move between the three pages (authentication, opp list, opp detail).  

Would someone be so kind as to give some guidance of how to get started?

Thanks!

Chris
Has anyone run into this issue?  I'm creating a lead with a Visual Flow form but the lead assignment rule doesn't assign it to Salesperson.

Help!

Chris
I'm new to Apex and trying to understand how to accomplish a fairly simple task in Batch Apex.  I'm trying to sum a field from a group of records and write it to a field on every account.  My code looks is below.  The bolded part is throwing the error Compile Error: Illegal assignment from LIST<AggregateResult> to Decimal at line 15 column 9. I understand what the error is but I'm not sure how to return the result correctly in this context.  

Thanks for any help you can provide!

global class CalculateACPY implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'Select Id, Name, Active_Contract_Amount__c from Account';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Account> scope)
    {
        for(Account a : scope)
        {
       a.Active_Contracts_Per_Year__c = [select sum(amount_per_year__c) from contract where EndDate < TODAY and id =:a.id];
        }
        update scope;
    }
    global void finish(Database.BatchableContext BC)
    {  
    }
}

Hi All,

 

Still very new to apex and visualforce so back with basic questions that I can't find the answers to.  Thanks in advance for any help that can be offered.

 

I'm having an issue with a SOQL query in my extension controller.  Basically what I'm trying to do is a create a list of custom object records (pricing_exception__c) in an embedded visualforce page on the opportunity layout.

 

I have the section created fine in visualforce but I can't get the list to come back correctly.  My code is as follows.  The ????????? needs to essentially be account.name of the opportunity page I'm on but nothing I'm trying is producing a result.  I'm starting to wonder if it's not possible to do this with an embedded vf page in the opportunity layout?

 

public class retrievePEList {

public retrievePEList(ApexPages.StandardController controller) {

}

 

public List<Pricing_Exception__c> getExceptions() {
return [SELECT Name, Pricing_Exception__c.Account_Name__c, End_User_Account_Name__c, PE_Status__c, Exception_End_Date__c FROM Pricing_Exception__c
WHERE PE_Status__c = 'Approved' and Exception_End_Date__c > TODAY and ???????????

}
}

Hi All,

 

I'm really enjoying the Salesforce platform but am very new to coding and have run into a few problems.

 

I have a custom object account_activity__c, that has several checkboxes on it that will be used to code interactions with our customers.  It also has a category field as well as a lookup relationship to another custom object (Project_Manager) where the interactions (account_activities) will be "housed".  

 

What I'm trying to do is create a visualforce page that will display a count of the "true" checkboxes for each question in each account_activity that is connected to the Project_Manager, grouped by category.  I'm stuck on multiple fronts.

 

1.  I'm trying to load this in a tab on the visualforce page I created to replace the detail view of the account_activity object.  I have a custom controller made and a visualforce page I'm loading in the tabbed interface.  Is there a simple way to pass the ID of the current record into Apex so I can use it in the SOQL query to filter account_activity by the lookup relationship ID?

 

My query right now is this and I need to somehow insert the ID of the page I'm loading in the where.  

 

Select category__c, Count(id) from Account_Activity__c Where Project_Manager__r.Id='a18c0000000LU8V' and question1__c=true group by rollup
(category__c)

 

2.  This query essentially gives me one row of data for my end product but it won't return a zero if a null is returned for any given category.  Is there a way to overcome this?  

 

I'm sure there are a million better ways to do what I'm trying to do, but I'm so new to coding I'm just trying to get it done any way I can.

 

Thanks!

 

Chris