Hi Yashh, If you want to update the newly created product field in the trigger then you can use it before insert like given below.
trigger ProductSamplerigger on Product2 (before insert) {
for (Product2 productObj : Trigger.new)
{
productObj.customField__c ='New Product'; // you can use your custom field here to assign the new Product value.
}
}
In case you find any other issue please mention. If you find your Solution then mark this as the best answer.
#Sample Code
trigger ProductTrigger on Product2 (before insert) {
for (Product2 p : Trigger.new)
{
p.testCustomField__c ='New Product';
}
}
Hope above information helps, Please mark as Best Answer so that it can help others in the future
trigger YourTrigger on Product2 (After insert) {
for (Product2 p : Trigger.new)
{
p.yourField__c='New Product';
}
update p;
}
If you want to update the newly created product field in the trigger then you can use it before insert like given below.
In case you find any other issue please mention.
If you find your Solution then mark this as the best answer.
Thanks and Regards
Suraj Tripathi.