+ Start a Discussion
crmninjacrmninja 

IDE Illegal Assignment from Double to String

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.

 

Best Answer chosen by Admin (Salesforce Developers) 
Scott.MScott.M
Did you check to make sure that leadpullqueues__c is a string in the production organization?
Message Edited by Scott.M on 03-24-2009 01:19 PM

All Answers

Scott.MScott.M
Did you check to make sure that leadpullqueues__c is a string in the production organization?
Message Edited by Scott.M on 03-24-2009 01:19 PM
This was selected as the best answer
crmninjacrmninja

Thank you, you were spot on.  ID-10-T error all the way. 

Lesson for all other novices experiencing similar issues: Check where you are deploying to just as thoroughly as where you are deploying from.

Message Edited by crmninja on 04-01-2009 08:32 AM