You need to sign in to do that
Don't have an account?
foodrunner
Compile Error: Expression cannot be assigned at line -1 column -1
In this workflow I have created a new record from the creation of an opportunity product record in a separate trigger. After the creation of the second record, I am needing to update the opportunity product record with the lookup value. With opportunity product records I can unable to use the object in a UI lookup field. I am receiving the following error:
Compile Error: Expression cannot be assigned at line -1 column -1
Here is the trigger:
trigger LinkonOLI on Manufacturing_Design_Sheet__c (after insert) { Set<Id> mids = new set<Id>(); for(Manufacturing_Design_Sheet__c m : trigger.new){ mIds.add(m.OpportunityLineItemID__c); } System.debug('****1 : m Id size '+ mIds.size()); List<Manufacturing_Design_Sheet__c> mds = [SELECT Id, name, OpportunityLineItemID__c FROM Manufacturing_Design_Sheet__c WHERE createddate =: system.now() and createdbyId = :UserInfo.getUserId() limit 1]; If(OpportunityLineItem.id = Manufacturing_Design_Sheet__c.OpportunityLineItemID__c){ OpportunityLineItem.spec_sheet__c = Manufacturing_Design_Sheet__c.OpportunityLineItemID__c; } }
How do I solve the error?
Thank you,
I don't understand your WHERE clause:
Aren't you just selecting the record that was just inserted? And anyway, system.now() returns DateTime including seconds, so it may not match the CreatedDate datetime value.
Good Point. I was not sure so I included the where clause just to be conservative in the codiing. I have changed the code and have the following error now:
New version of trigger:
How to I make the field expression concrete?
Thank you
You don't need to select the mds records because you already have them in the Trigger.New. What you need to retrieve are the OpportunityLineItems based on the set of opplineitem IDs you created. Then you do a double FOR loop so you can match the OLI to the mds and do your assignment.
I feel that there is a problem with your if condition. Try changing the condition as given below :
if(OpportunityLineItem.id == Manufacturing_Design_Sheet__c.OpportunityLineItemID__c){OpportunityLineItem.spec_sheet__c = Manufacturing_Design_Sheet__c.OpportunityLineItemID__c;}
Hope this helps.