Hi raviteja p 21 Please try below code. Using trigger we will get the auto populate the Lookup field values.
trigger updatefield on OpportunityLineItem (after insert) { // user defaultuser = [select id from user where name = 'default user']; for (OpportunityLineItem record:trigger.new) { if(record.Product_Owner__c ==null) { record.Product_Owner__c = userinfo.getUserId(); } } }
Let me know if you have any query. Mark it as a best answer if it help you.
Yes it can be autopopulated if its a visual force page but this doesn't happen if its a standard page.After save we can set the values through trigger or process builder or other automations. but doesnot happen once the lookup value is selected .
Please try below code.
Using trigger we will get the auto populate the Lookup field values.
trigger updatefield on OpportunityLineItem (after insert) {
// user defaultuser = [select id from user where name = 'default user'];
for (OpportunityLineItem record:trigger.new) {
if(record.Product_Owner__c ==null) {
record.Product_Owner__c = userinfo.getUserId();
}
}
}
Let me know if you have any query.
Mark it as a best answer if it help you.
Thanks,
Ajay Dubedi
Yes it can be autopopulated if its a visual force page but this doesn't happen if its a standard page.After save we can set the values through trigger or process builder or other automations. but doesnot happen once the lookup value is selected .
Thanks