function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CharanKumarRajuCharanKumarRaju 

Auto Populate one object field values into another object

Hi,

Can anybody help me on this please.

 

I have two objects.1) Opportunity 2) Project

 

I have 2 custom fields on both objects called i) Business Unit  ii) Practise.

Now, I created an Opportunity. In the related list I get Project. If I click on Projects, it redirects to Projects Object. In that I have to auto populate the field values which I already entered in Opportunity object. Also I have to auto populate Account name in Projects object.

 

Thanks,

Charan

 

 

 

prakash_sfdcprakash_sfdc

Try the following:

Override the save button to redirect to URL as follows:
change "cs1" as per your instance.

https://cs1.salesforce.com/500/e?id of Business Unit field in Project object={!Opportunity.Business_Unit__c}
&id of Practice field in Project object={!Opportunity.Practice__c}
&id of Account Lookup field in Project object={!Opportunity.AccountID}
&retURL=/{!Opportunity.Id}

You have to get field ID's not the Field names.

CharanKumarRajuCharanKumarRaju
Hi, if you don't mind can send me screen shots please as I am new to .sfdc
souvik9086souvik9086

Hi,

 

I think that Project is a child object of Opportunity. In that case you fire a trigger on Opportunity(insert/update) .
In that trigger you fetch all the projects for that particular opportunity and assign the business unit and practise fields from opportunity to projects like

List<Projects__c> prjList = new List<Projects__c>();

prjList = [select id, name ,Practise__c,BusinessUnit__c from Projects__c where OpportunityLookUpField = : Trigger.new[0].ID;

 

for(Projects__c prj: prjList){

prj.BusinessUnit__c = Trigger.new[0].BusinessUnit__c;

prj.Practise__c = Trigger.new[0].Practise__c;

upsert prj;

}

 

If this solves your problem please marked it as solution.

Thanks