• crmninja
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I have developed a VF page and some Apex code for a Lead Pull Management system.  In short, the function responds to the user's daily allowance (and pulls) of Leads and determines if he/she can pull more Leads.  In the sandbox, the combined functions are working properly.  Running the tests classes in the Sandbox (and IDE) generate no errors and give me a coverage of 90%. 

My issue is in attempting to deploy the code to production.  When attempting to do this, I receive an error of "Illegal Assignment from Double to String" for Line 14 Column 8.  This line is intended to tell the VF Controller what Queue to pull Leads from.  As you can see, I have tried to a few different approaches for working around this issue with no success.  I am confused as to why IDE is reading this as a double.  Is it the lack of quotes, or my approach of reading from the user to assign the variable?  Any insights would be very much appreciated.  

 

Here is the Controller.....

 

global without sharing class TomController{ public String getResult(){ return res; } private String res=null; User U = [select id, LeadPullQueues__c from User where id = :Userinfo.getUserId()]; //Here we set variables utilized later to define user-specific search parameters public Double MAX= [select TruePerDiem__c from User where ID = :userinfo.getuserid()][0].TruePerDiem__c; //Public Integer Diem = Integer.valueOf(Max); public Integer Diem = Max.intvalue(); public string Q = u.leadpullqueues__c;//Line generating error message //String Queue = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()].LeadPullQueues__c; //public String Queues = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()][0].LeadPullQueues__c; //Public String Queue = String.valueOf(Queues); public Double Now= [select PulledToday__c from User where ID = :userinfo.getuserid()][0].PulledToday__c; //public Integer Was = Integer.valueOf(Now); public Integer Was = Now.intvalue(); //public Integer Took = (Was + Diem); public PageReference doSearch() { // We update the Lead records only when the owner id = User's Lead Pull Queue Value List<Lead> leads = [select Id,ownerid,PulledYes__c from lead where ownerid = :Q limit :Diem]; List<User> Users = [select ID, PulledToday__c from User where ID = :userinfo.getuserid() Limit 1]; ID u = [select ID from User where ID = :userinfo.getuserid()][0].Id; //Integer BestCount = leads.size(); //Ideally, we could have created the above User list and used the "BestCount" Integer //to write back the true value of Leads pulled to the current users SFDC User record. //Unfortunately, SFDC wont allow Apex to update Users via DML within a method updating another object type for(Lead l:leads){ l.ownerid=u; l.PulledYes__c='yes'; } update leads; res = 'success'; return new PageReference('/00Q/o'); } }

 

 The code definitely needs some cleansing and I intend to use one SOQL call from which I will derive the separate variables.  Aside from that, any input (beyond the error message I am receiving when attempting to validate the deployment in IDE) would be greatly appreciated.  As with most other posters seeking advice, I am new to APEX.

 

I have a Line Item Custom Object on Contracts. It allows our Sales Team to book line items against a contract. There maybe multiple line items all with differing Start and End Dates, Length of Days, Total Video Streams(over that period) and Streams per day.

 

We want to do something with a Report that will show Booked Streams for a given month.

 

Example:

 

Contract A

 

Example 1 - with field names

 

Line Item 1 - Start Date(Start_Date__c) = 1/28/2009 - End Date(End_Date__c) = 6/12/2009 - Length of Days(Length_of_Days__c this is a formula field - ( End_Date__c - Start_Date__c )+1) = 136 - Total Video Streams (Total_Line_Item_Streams__c) = 5,000,000 - Streams per Day(Streams_per_Day__c this is also a formula field - Total_Line_Item_Streams__c / Length_of_Days__c) = 36,765

 

Line Item 2 - Start Date = 3/1/2009 - End Date = 7/31/2009 - Length of Days = 153 - Total Video Streams = 5,000,000 - Streams per Day = 32,680

 

 

How can my Report show how many Streams are booked for the Month of April? Is it at all Possible?

Message Edited by MATTYBME on 04-22-2009 10:19 AM

If a picklist has a single-quote in it, like:

 

   Said 'hi!'

 

It appears we should create SOQL to query this like:

 

     select FirstName, Email from Contact where LeadSource = 'Said \'hi!\''

 

This executes without error, but generates zero rows, even though I set the LeadSource for a contact to have this value.  Is this a Salesforce bug, or should the SOQL be formatted differently?

 

Thanks

I have developed a VF page and some Apex code for a Lead Pull Management system.  In short, the function responds to the user's daily allowance (and pulls) of Leads and determines if he/she can pull more Leads.  In the sandbox, the combined functions are working properly.  Running the tests classes in the Sandbox (and IDE) generate no errors and give me a coverage of 90%. 

My issue is in attempting to deploy the code to production.  When attempting to do this, I receive an error of "Illegal Assignment from Double to String" for Line 14 Column 8.  This line is intended to tell the VF Controller what Queue to pull Leads from.  As you can see, I have tried to a few different approaches for working around this issue with no success.  I am confused as to why IDE is reading this as a double.  Is it the lack of quotes, or my approach of reading from the user to assign the variable?  Any insights would be very much appreciated.  

 

Here is the Controller.....

 

global without sharing class TomController{ public String getResult(){ return res; } private String res=null; User U = [select id, LeadPullQueues__c from User where id = :Userinfo.getUserId()]; //Here we set variables utilized later to define user-specific search parameters public Double MAX= [select TruePerDiem__c from User where ID = :userinfo.getuserid()][0].TruePerDiem__c; //Public Integer Diem = Integer.valueOf(Max); public Integer Diem = Max.intvalue(); public string Q = u.leadpullqueues__c;//Line generating error message //String Queue = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()].LeadPullQueues__c; //public String Queues = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()][0].LeadPullQueues__c; //Public String Queue = String.valueOf(Queues); public Double Now= [select PulledToday__c from User where ID = :userinfo.getuserid()][0].PulledToday__c; //public Integer Was = Integer.valueOf(Now); public Integer Was = Now.intvalue(); //public Integer Took = (Was + Diem); public PageReference doSearch() { // We update the Lead records only when the owner id = User's Lead Pull Queue Value List<Lead> leads = [select Id,ownerid,PulledYes__c from lead where ownerid = :Q limit :Diem]; List<User> Users = [select ID, PulledToday__c from User where ID = :userinfo.getuserid() Limit 1]; ID u = [select ID from User where ID = :userinfo.getuserid()][0].Id; //Integer BestCount = leads.size(); //Ideally, we could have created the above User list and used the "BestCount" Integer //to write back the true value of Leads pulled to the current users SFDC User record. //Unfortunately, SFDC wont allow Apex to update Users via DML within a method updating another object type for(Lead l:leads){ l.ownerid=u; l.PulledYes__c='yes'; } update leads; res = 'success'; return new PageReference('/00Q/o'); } }

 

 The code definitely needs some cleansing and I intend to use one SOQL call from which I will derive the separate variables.  Aside from that, any input (beyond the error message I am receiving when attempting to validate the deployment in IDE) would be greatly appreciated.  As with most other posters seeking advice, I am new to APEX.