• Kevin Horwitz
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I'm using a datatable in VF and I can normally get it to populate via my controller.  However, I need a dynamic variable in my SOQL to have the end user sort by the choice of headers in the table and I apparently keep passing NULL values to the string.  I'm a rookie with Apex and a novice with VF when it comes to working with Controllers, so I'm trying to figure out how to pass the myString value from VF to the SOQL in my Controller (code listed below).  Ideally I'd like to send this info via a commandlink in the column headers within in the datatable, but I'm fairly open to suggestions.  Thoughts?

Controller:

public class dataTableOli {
public String myString {get;set;}
String myquery =       
            'SELECT id,Opportunity.Product_Name__c,Opportunity.Account.Name,Opportunity.Account.Agency_Names__c,Opportunity.Account.Customer_Number__c,Opportunity.Account.Agency_Customer_ID__c,unitprice,opportunityid,Opportunity.StageName,Opportunity.Name,Opportunity.id,Opportunity.Previous_Expire__c,Opportunity.Previous_Amount__c,Opportunity.Product_Tier__c,Opportunity.Add_Print_Subscription__c,Name ' +
            'FROM OpportunityLineItem ' +
            'WHERE Opportunity.Account.Agency_Names__c=\'001j000000R7b8s\' and CALENDAR_YEAR(Opportunity.Previous_Expire__c) =2017 and CALENDAR_MONTH(Opportunity.Previous_Expire__c) =12  and Opportunity.Previous_Amount__c > 0 '+
            'ORDER BY '+MyString+ ' ASC Limit 10';
            
List<OpportunityLineItem> oli;
    public List<OpportunityLineItem> getoli() {

if(oli==NULL) 
   oli=Database.query(myquery);

      return oli;
}
   }

 
I'm trying to create a Workflow to send an Email Alert and update a field when a field equals a specific #.  Here's the full situation:

I need to send out a series of e-mail alerts based on the difference between a date field (Expire_date__c) and today's date.  This # is calculated by a formula the date_diff__c field.  When an e-mail is sent, I want the 'Renewal_email_count__c' field to increase by 1 (starts at 0, then goes to 1, then 2, etc) every time this rule triggers.   

Anyway, let's talk about the first e-mail that should trigger.  When the Date Diff field equals 90, I want the e-mail alert to go out and to add 1 to the Renewal Email Count field.  However, I can't seem to get it to trigger automatically.  By that I mean that if I let the Date Diff field calculate 'naturally' by having 91 days change to 90 days at midnight, nothing happens.  However, I can go into the record, change the Expire Date so that the Date Diff will equal 90, save it, and everything will trigger.

I've even taken it a step further and put in a '90 Days' checkbox that gets checked when the Date Diff field equals 90 and then tied the workflow to whether the 90 Days checkbox is checked.  Still nothing.  

Help!
I'm using a datatable in VF and I can normally get it to populate via my controller.  However, I need a dynamic variable in my SOQL to have the end user sort by the choice of headers in the table and I apparently keep passing NULL values to the string.  I'm a rookie with Apex and a novice with VF when it comes to working with Controllers, so I'm trying to figure out how to pass the myString value from VF to the SOQL in my Controller (code listed below).  Ideally I'd like to send this info via a commandlink in the column headers within in the datatable, but I'm fairly open to suggestions.  Thoughts?

Controller:

public class dataTableOli {
public String myString {get;set;}
String myquery =       
            'SELECT id,Opportunity.Product_Name__c,Opportunity.Account.Name,Opportunity.Account.Agency_Names__c,Opportunity.Account.Customer_Number__c,Opportunity.Account.Agency_Customer_ID__c,unitprice,opportunityid,Opportunity.StageName,Opportunity.Name,Opportunity.id,Opportunity.Previous_Expire__c,Opportunity.Previous_Amount__c,Opportunity.Product_Tier__c,Opportunity.Add_Print_Subscription__c,Name ' +
            'FROM OpportunityLineItem ' +
            'WHERE Opportunity.Account.Agency_Names__c=\'001j000000R7b8s\' and CALENDAR_YEAR(Opportunity.Previous_Expire__c) =2017 and CALENDAR_MONTH(Opportunity.Previous_Expire__c) =12  and Opportunity.Previous_Amount__c > 0 '+
            'ORDER BY '+MyString+ ' ASC Limit 10';
            
List<OpportunityLineItem> oli;
    public List<OpportunityLineItem> getoli() {

if(oli==NULL) 
   oli=Database.query(myquery);

      return oli;
}
   }

 
I'm using a datatable in VF and I can normally get it to populate via my controller.  However, I need a dynamic variable in my SOQL to have the end user sort by the choice of headers in the table and I apparently keep passing NULL values to the string.  I'm a rookie with Apex and a novice with VF when it comes to working with Controllers, so I'm trying to figure out how to pass the myString value from VF to the SOQL in my Controller (code listed below).  Ideally I'd like to send this info via a commandlink in the column headers within in the datatable, but I'm fairly open to suggestions.  Thoughts?

Controller:

public class dataTableOli {
public String myString {get;set;}
String myquery =       
            'SELECT id,Opportunity.Product_Name__c,Opportunity.Account.Name,Opportunity.Account.Agency_Names__c,Opportunity.Account.Customer_Number__c,Opportunity.Account.Agency_Customer_ID__c,unitprice,opportunityid,Opportunity.StageName,Opportunity.Name,Opportunity.id,Opportunity.Previous_Expire__c,Opportunity.Previous_Amount__c,Opportunity.Product_Tier__c,Opportunity.Add_Print_Subscription__c,Name ' +
            'FROM OpportunityLineItem ' +
            'WHERE Opportunity.Account.Agency_Names__c=\'001j000000R7b8s\' and CALENDAR_YEAR(Opportunity.Previous_Expire__c) =2017 and CALENDAR_MONTH(Opportunity.Previous_Expire__c) =12  and Opportunity.Previous_Amount__c > 0 '+
            'ORDER BY '+MyString+ ' ASC Limit 10';
            
List<OpportunityLineItem> oli;
    public List<OpportunityLineItem> getoli() {

if(oli==NULL) 
   oli=Database.query(myquery);

      return oli;
}
   }