You need to sign in to do that
Don't have an account?
![NikunjVadi NikunjVadi](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Assigning value to field (Field name is stored in string)
i want to assigned a constant value for the field stored in a string . But i am getting an error:Expression cannot be assigned
What is wrong with :
refOpportunityItem.get(Tierfield) = -1;
What is wrong with :
refOpportunityItem.get(Tierfield) = -1;
Opportunityitem__c refOpportunityItem = new refOpportunityItem(); public void tierNumbers() { if(refOpportunityItem.Number_Of_Tier__c != Null) { NumberOftier=Integer.valueOf(refOpportunityItem.Number_Of_Tier__c); TierField ='Upper_Quantity_Tier_2__c'; refOpportunityItem.Upper_Quantity_Tier_2__c = -1; ------In the next row i am getting error refOpportunityItem.get(Tierfield) = 1; //refOpportunityItem.get(Tierfield); } {
refOpportunityItem.put(TierField,-11);
On line 11, you are assigning the value 1 to the expression thats why.