+ Start a Discussion
sriphani ramakasriphani ramaka 

Create a trigger to populate account value on Proposal record from opportunity (only on create proposal)can anyone give me trigger for this

v varaprasadv varaprasad
Hi Sriphani,

Please check once below sample code : 
Trigger updateProposal on proposal_c(Before insert){
  set<id> oppIds = new set<id>();
  for(proposal_c pro : trigger.new){
      if(pro.opportunity__C != null){
  Map<id,opportunity> oppmap = new   Map<id,opportunity> ([slect id,name,accountid,account.name from opportunity where id in : oppIds]);
  //Use above map and add field to proposal
  for(proposal_c pro : trigger.new){
   pro.name = oppmap.get(pro.opportunity__C).account.name;


You can use process builder for the above functionality.

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: varaprasad4sfdc@gmail.com

Salesforce latest interview questions and training videos :

If you have any projects in Salesforce regarding my knowledge, I will happy to work with you.

My contact Details are listed below.

V Varaprasad
Email: varaprasad4sfdc@gmail.com
Mobile No :+91 9393934143