I have a custom object called Orders that has a lookup field with another custom object called Product. I am assigning the product ID from product with the ID column in orders. Product's ID field is a text field and Orders' ID field is a lookup field with relationship to Product's ID field.
When assigning the id using the code below
Order__c newORD = new Order__c(); newORD.Item_Code__c = sku.Item_Code__c;
sku is of type Product and
newORD is of type Order, the error System.StringException invalid ID appears. There are no validation rules on the lookup field.