PartOfTheOhana
PartOfTheOhana

Reputation: 685

SalesForce, How do I update a field on one object from using data from another obj?

In SalesForce. I have 3 objects in an MDR:

obj_1 ---< obj_2 >--- Contacts.

Object_1 = meeting types and budget

Object_2 = attendees at each meeting and money spent on each.

Each time a record involving a contact in obj_2 gets updated, I need to update a field in the contacts object ONLY if the meeting took place in the past year.

How do I do this? Workflows? Formulas?

Upvotes: 0

Views: 12944

Answers (1)

This can be accomplished by a workflow or an Apex Trigger.

To use a workflow, go to Setup - Create - Workflow & Approvals - Workflow Rules.

  • Click 'New rule'
  • Select the Obj2 if that's the object that initiates change
  • Choose a name for the rule such as 'Update contact on Obj2 update'
  • Specify criteria for when workflow should be enacted by selecting 'formula evaluates to true' from a dropbox in the 'Rule Criteria' section and writing in the formula editor something like: DATEVALUE(MeetingDate) > DATE(YEAR(TODAY())-1, MONTH(TODAY()), DAY(TODAY())).
  • Click 'Save & Next'
  • Choose 'New Field Update' from the 'Add workflow action' dropbox.
  • Pick a name for the update action such as 'Update contact budget'
  • Specify the field to be updated by selecting from dropboxes below Contact and the field name in Contact such as ContactBudget
  • In the 'Specify new field value' section below choose 'Use a formula to set the new value' and enter the name of the field in Obj2 that specifies the budget like Meeting_budget__c
  • Save
  • Go to Setup - Create - Workflow & Approvals - Workflow Rules again
  • Click 'Activate' next to the rule you have just created

Greets, lenin_ra

Upvotes: 1

Related Questions