• salesforce expert
  • NEWBIE
  • 83 Points
  • Member since 2011

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

Hi ,

 

I have a field with decimal type. i m filtering it in my query , it is giving me following error.

System.QueryException: value of filter criterion for field 'Price__c' must be of type double and should not be enclosed in quotes


Price__c is currency type

and price is deimal type and i have tried double also

 

 Follwoing Query i m excuting -:

string property ='Select p.Vacant_or_Occupied__c, p.Property_Type__c, p.Price__c, p.Name, p.Location__c, p.Bedrooms__c, p.Available__c From Property__c p where Name != null';

 

if(price != null){
property += ' And Price__c = \''+price+'\'';
}

database.query(property);

 

 

Thanks

Shailu

 

  • December 27, 2011
  • Like
  • 0

hi,

 

i am having a requirement for the client which needs to create a csv file for the some cases record and download it to the user... any ideas! please share

Hi ,

      I got a error , Account type is not visible . I checked sharing settings it is fine  , I am working as sys admin , My apex code is correct , I dont know where i gone wrong , Can any one help me ?..

 

Thanks ,

 

Jana

i have created a custom link on account detail page. the link works fine if there is no white space. this link works fine https://na11.salesforce.com/00OG0000002imXl?pv0=test+agency as it is an account "test agency" but it failed to pull the report when the account name is "test agency, LLC". the link is rendered as https://na11.salesforce.com/00OG0000002imXl?pv0=test+agency%2C+LLC. when i look the look report it removes the space between comma and LLC.

 

please help!

 

Thanks

Baskaran

Hi,

 

I have a currency field. My requirement is displaying currency in string format on visual force page. Please any one help me.

 

Thanks,

Lakshmi

Can we create apex triggers for time based workflow rules.. if so give me one simple example 

  • January 02, 2012
  • Like
  • 0

Hi,

 

I am Suhasini, I have been working in Salesforce for the past 1 year or so.  I have Dev 401 Certification scheduled in another 20 days. I am tensed as I have not yet started preparing for the certification because of hectic workload in Office.

 

I request you to kindly send me the Certification Dumps to my mail suhasinireddyg@gmail.com, which would be of great help to me.

 

Also, please advice me on the way to prepare for Dev in these 15-20 days and the important areas to focus more in preparation.

 

Thanks a lot for your help in advance,

Suha.

 

  • December 31, 2011
  • Like
  • 0

Is there a way to move trigger logic into an apex class?  I want to add a few lines into a current trigger that references an apex class that does the logic.  I'm running into trouble when trying to replicate the trigger in a class, mainly when I get to the Trigger.new method, can this be called into an apex class, as well as the Trigger.oldmap?

 

Here is the logic in the trigger, which works fine, it creates a record into a related list if a field changes.

 

Any advise?  Will the logic be possible to put into a class and how would I use the trigger.oldmap and Trigger.New methods?

 

Below is the trigger and then below this is the class I am trying to move it too:

 

trigger FieldChangeTrigger on QuoteLineItem (after update) {

 

List <QLI_History_Tracking__c> history = new List <QLI_History_Tracking__c>();

for (QuoteLineItem qli : Trigger.new) {

if(qli.UnitPrice != Null && qli.UnitPrice != trigger.oldMap.get(qli.Id).UnitPrice)
{
history.add(new QLI_History_Tracking__c (
Quote_Line_Item__c = qli.Id,
Sales_Price_From__c = trigger.oldMap.get(qli.Id).UnitPrice,
Sales_Price_To__c = qli.UnitPrice
));
}

if(history.size() >0)
{
insert history;
}

}

 

 

 

Here is what I will be changing the trigger into:

 


trigger FieldChangeTrigger on QuoteLineItem (after update) {

//need to copy all relevant fields so they will always pick up previous values when one is changed
//object wil be called pricing history

if(Trigger.isUpdate && Trigger.isAfter){

managePricingHistory.afterupdate(Trigger.New);

}

 

 

 

An then the above trigger will reference this class

 

public with sharing class managePricingHistory {


public static list<QuoteLineItem> afterUpdate(list<QuoteLineItem> qli) {

List <QLI_History_Tracking__c> history = new List <QLI_History_Tracking__c>();

 

for (QuoteLineItem qlit : Trigger.new) {  

// I'm getting an error message here that says "Loop variable must be of type SObject


}

if(history.size() >0)
{
insert history;
}

return qli;
}

}

 

 

 

 

Hi ,

 

I have a field with decimal type. i m filtering it in my query , it is giving me following error.

System.QueryException: value of filter criterion for field 'Price__c' must be of type double and should not be enclosed in quotes


Price__c is currency type

and price is deimal type and i have tried double also

 

 Follwoing Query i m excuting -:

string property ='Select p.Vacant_or_Occupied__c, p.Property_Type__c, p.Price__c, p.Name, p.Location__c, p.Bedrooms__c, p.Available__c From Property__c p where Name != null';

 

if(price != null){
property += ' And Price__c = \''+price+'\'';
}

database.query(property);

 

 

Thanks

Shailu

 

  • December 27, 2011
  • Like
  • 0

Hi All,

 

We want to DO a HTTPpost with Certain data related to cases only when a case is closed.

Is it Possible and is there any example for the same?

 

Regards

Pradeep

Hi all,

      I have this triggger that is written on accounts,It creates a new record in summary, when the account is inserted for the first time and updates the same record  next time onwards (if 2 records are same with same account name).Delete  function is also performed accordingly.

Here is the trigger given below:

 

 

trigger insertinSummary on Account (before insert,after delete)
{
//If record is deleted
if(trigger.isdelete)
{
Account acc=trigger.old[0];
list<Summary__c> summlist =[select Total_No_Of_Accounts__c,Total_Money_from_Account__c from Summary__c where name = : acc.name];
if(summlist.size()>0)
{
for(integer i=0;i<summlist.size();i++)
{
summlist[i].Total_No_Of_Accounts__c=summlist[i].Total_No_Of_Accounts__c-1;
summlist[i].Total_Money_from_Account__c=summlist[i].Total_Money_from_Account__c-acc.Money_from_Account__c;
}

update summlist;

}

 

}



//If record is inserted for the first time
if(trigger.isinsert)
{
Account acc=trigger.new[0];
list<account>accclist=[select id from account where name=:acc.name];
//if the added record doesn't exist in account object then the list size will be 0 and new entry will be made
if (accclist.size()==0)
{
Summary__c ss=new Summary__c(name=acc.name,Total_No_Of_Accounts__c=1,Total_Money_from_Account__c=acc.Money_from_Account__c);
insert ss;
}
else
{
//if the added record is already there then the values will be updated in the existing summary record

list<Summary__c> summlist=[select name,Total_No_Of_Accounts__c, Total_Money_from_Account__c from Summary__c where name =: acc.name];

for(integer i=0;i<summlist.size();i++)
{
summlist[i].Total_No_Of_Accounts__c=summlist[i].Total_No_Of_Accounts__c+1;
summlist[i].Total_Money_from_Account__c=summlist[i].Total_Money_from_Account__c+acc.Money_from_Account__c;

}
update summlist;

 



}

}

 

 

}

 

 

Now I wanna change the trigger so that records of summary__c are clubbed on basis of ownerId of accounts rather than Account Name.

                   So that, account  record is created for the first time with new Owner Id a new summary recoerd is created and next time onwards that same summary record is updated (instead of creating a new one).Irrespective of account name I wanna calculate the no.of accounts and total money that one owner/user has.

More of a theoretical question - in the displayfields function below is it possible to do what I've done in pseudocode?

 

main(){
  sobject acc = [select name, phone from account limit 1];
  displayfields(acc);
}

static void displayfields(sobject x){
  //somehow loop through the available fields on the sobject
  //and display them
  for(field f:x.fields) system.debug(f.fieldname);  //should print out "name" , "phone"
}

 

Thanks!

 

Tyler

 

Hi,

 

      My class is working now.But any changes to existing class means adding a blank space  or line or any change to existing code is promping me an error for the existing code.Any Idea?

 

Thanks

I wanted to see if it is possible to create multiple customer portal users that use the same account ID and same account accesses.  Please note that I've only one contact for the account.

 

Thanks!

Hi

 

while converting Text Area(Long) Data Type into Text Area(Rich) will existing data be lost?

 

Thanks!

  • December 19, 2011
  • Like
  • 0

hi,

 

i am having a requirement for the client which needs to create a csv file for the some cases record and download it to the user... any ideas! please share

There are 3 objects- Account(std object),oppurtunity(std object),Application(custom object).Oppurtunity and application are linked via master detail relationship.I I have created 2 record types for account. I need to write a trigger on account so that when account record type is set to a specific value and client id(text field on account) is not null then status(picklist field on application )is automatically updated to a specific value.

i need to get the aggreagted result of opportunity records where there is not conitional pick up... it may go lakhs in future...but my applicaiton is running on force.com platform......any one can help me how to pick up the records in bulk mode......

Hi all,

 

I have a template renamed in my Org but eclipse still retained the old template name and did not update the name of the new template in package.xml file under the types tag. And now it has a warning message in the Problems window saying "Refresh error: Entity of type 'XXXXTemplate' named 'unfiled$public/XXXXX_Template' not found package.xml,  /DevOrg/src,  line 1, Force.com retrieve problem"

 

Any help would be appreciated as I don't want to create anymore new projects and fetch it again. Thanks

from here:

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_calls_soql_select_count.htm|StartTopic=Content%2Fsforce_api_calls_soql_select_count.htm|SkinName=webhelp

 

SELECT Name, Count(Id)
FROM Account
GROUP BY Name
HAVING Count(Id) > 1

 

i can see the field expr0, but it doesnt show the actual count :(

is there another tool to run soql other than eclipse?

Hi there,

 

I have a Batch Apex class that I am trying to test, and for some reason, the test is successful in the Sandbox - when I run it from the IDE, but unsuccessful during deployment.

 

Code is below - any clues would be highly appreciated!

 

 

global class OpenProjectsCount implements Database.Batchable<sObject>{
	
	String query;
	
	global OpenProjectsCount(){
		query = 'SELECT id, Open_Projects__c FROM Contact';
	}
	
	global Database.QueryLocator start(Database.BatchableContext BC){
	
	   return Database.getQueryLocator(query);
	}
	
	global void execute(Database.BatchableContext BC, List<Contact> scope){
		for(Contact c:scope){
			c.Open_Projects__c = [select Count() from Opportunity where Related_Contact__c =: c.id and StageName!='Lost' and StageName!='Finished' and StageName!='Cancelled'];
		}
		update scope; 
	}
	
	global void finish(Database.BatchableContext BC){

	}

}

 

 

and the test class is:

 

 

@isTest
private class TestOpenProjects {

    static testMethod void myUnitTest() {
        Contact c = new Contact(LastName='TestContact');
        insert c;
        
        List <Opportunity> opp = new List<Opportunity>();
        
        for(integer i=0; i<200; i++){
        	Opportunity o = new Opportunity(Name='Test Project'+i, Related_Contact__c=c.id, StageName='Discussions', CloseDate=date.today());
        	opp.add(o);
        }
        insert opp;
        
        Test.StartTest();
        OpenProjectsCount ops = new OpenProjectsCount();
        ID batchprocessid = Database.executebatch(ops);
        Test.StopTest();
        
        List<Contact> con = [SELECT Open_Projects__c FROM Contact WHERE id=:c.id];
        System.assertEquals(con[0].Open_Project__c, 200);
    }
}

 

 

Of course, if I remove the System Assert, at least I dont fail the test, and I am able to deploy the class, but this is still an area of concern to me. Any pointers would be extremely helpful!

 

thanks,

Pranav

 

  • September 14, 2010
  • Like
  • 0