You need to sign in to do that
Don't have an account?
Sami Shakith
Error: Compile Error: Expression cannot be assigned at line -1 column -1
Hi,
i am getting an Error: Compile Error: Expression cannot be assigned at line -1 column -1 while saving this code. Can anyone please tell me where i made mistakes and what will be solution?
public class Values
{
public string rate{get; set;}
@future(create=true)
public static void create()
{
values val=new values();
List<Account> Acc = new List<Account>();
Acc = [Select id from Account where Minutes__c!=null];
if(Account.Minutes__c = 'v1')
{
val.rate='$1.00';
}
if(Account.Minutes__c = 'v2')
{
val.rate='$2.00';
}
}
}
i am getting an Error: Compile Error: Expression cannot be assigned at line -1 column -1 while saving this code. Can anyone please tell me where i made mistakes and what will be solution?
public class Values
{
public string rate{get; set;}
@future(create=true)
public static void create()
{
values val=new values();
List<Account> Acc = new List<Account>();
Acc = [Select id from Account where Minutes__c!=null];
if(Account.Minutes__c = 'v1')
{
val.rate='$1.00';
}
if(Account.Minutes__c = 'v2')
{
val.rate='$2.00';
}
}
}
All Answers
(create=true) is nothing if want to do callout the you can use (callout=true)
Please try below code
NOTE :-
1) Methods with the future annotation must be static methods
2) can only return a void type
3) The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types
4) Methods with the future annotation cannot take sObjects or objects as arguments.
5) You can invoke future methods the same way you invoke any other method. However, a future method can’t invoke another future method
6) No more than 50 method calls per Apex invocation
7) Asynchronous calls, such as @future or executeBatch, called in a startTest, stopTest block, do not count against your limits for the number of queued jobs
8) The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater
9) To test methods defined with the future annotation, call the class containing the method in a startTest(), stopTest() code block. All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously
Please check below blog for more information
http://amitsalesforce.blogspot.in/2015/02/future-methods-in-salesforce.html
Thanks
Amit Chaudhary