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
Swapnil PatneSwapnil Patne 

Trigger to copy details of contact fields from a specific contact to Account fields

Hi,

Need help on writing a trigger to copy details of contact fields from a specific contact to Account fields.

Logic:

If contact Member Suspended = No and SCM Member Type = CWL then,

Copy below field details from that contact to Account fields:

Contact Fields                      Account Fields         Data Type
Member Suspended   >>>      Active                        Picklist
Member Since           >>>      Member Since            Date Field
Date Last Renewed    >>>      Date Last Renewed    Date Field
Expiry Date               >>>      Expiry Date                Date Field
License Term            >>>       License Term             Picklist

Please could someone help me?

Thanks,
Swapnil
Vinita_SFDCVinita_SFDC
Hello Swapnil,

You can acieve this with workflow only, there is no need to write a trigger for this.

In evaluation criteria only you can specify specific contact and account details and condition, then you can have a cross object field update on account object.
Swapnil PatneSwapnil Patne
HI Vinita, 

Thanks for you comment and it would be nice to have it simple WF to make this all happen, but for me the question is how and what do I define in work flow to make it happen. May be if you can explain and guide a bit more wit some detail steps I may figure it out. 

Thanks,
Swapnil
Vinita_SFDCVinita_SFDC
Hello Swapnil,

If you are not familiar with workflows then i would suggest you to refer few examples provided in following help Doc:

http://help.salesforce.com/HTViewHelpDoc?id=workflow_examples.htm&language=en_US

https://login.salesforce.com/workflow/tutorial/creatingworkflowrule.htm

You can have WF like:

Workflow on Accounts

Evaluate the rule when a record is:  when records are created or edited

Rule Criteria (Filter): Contact name = ABC and Account name = XYZ
and

contact Member Suspended = No and SCM Member Type = CWL

Immediate Actions : Field update
Swapnil PatneSwapnil Patne
I went through the doc but it doesn't provide the solution I need.. I researched a bit and understand that it requires a trriger to make this work.. any suggestions on wrriting cross object triggers..?