You need to sign in to do that
Don't have an account?

product object s where we need to fetch from Ampics picklist value and assaign to other custom field
we have two fields in product object Ampics_PL__c and Pieces_in_Pack__c where we need to fetch the value from Ampics='utilix ' picklist value and assaign to the Pieces_In for eg we have Cable/10002 this 10002 must be split and assaign to Pieces_in_Pack__c custom field
Error:Expression cannot be assigned at line -1 column -1
trigger UpdateProductField on Product2 (after insert, after update) {
Set<Id> Product2Id = new Set<Id>();
for (Product2 Product : Trigger.new) {
if(Product.Ampics_PL__c != null && Product.Ampics_PL__c.equals('Utilix')) {
product2ID.add(Product.Id);
}
}
List<Product2> UpdateProductField = new List<Product2>();
for(Product2 p:[Select Id, Ampics_PL__c,Pieces_in_Pack__c from product2 where Ampics_PL__c = 'Utilix'] )
{
Product2.Ampics_PL__c = Product2.Ampics_PL__c;
String str = 'Ampics_PL__c';
String[] sstr = str.split('/');
system.debug(sstr[0]);
system.debug(sstr[1]);
}
update UpdateProductField;
}
Instead of Product.Ampics_PL__c.equals('Utilix') change it to Product.Ampics_PL__c == 'Utilix'
Thanks Anu
If that is the case can you help with a little bit of code we have 2 custom objs in Product object Ampics and pices in pack and this ampics is pick list value where we need to do for one particular value Ampics=utilix and eg cable/100 the last /100 value must sent to other custom field pices in pack
Please help me thanks in advance
i will explain you clearly we have two fields in product object Ampics_PL__c and Pieces_in_Pack__c where we need to fetch the value from Ampics='utilix ' picklist value and assign to the Pieces_In_pack__c which is other custom field if there is no value it must be default to 1 eg:cable/1234 this 1234 will be the value of Piece in pack
Thanks