简体   繁体   English

SalesForce,如何使用另一个obj的数据更新一个对象上的字段?

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

In SalesForce. 在SalesForce中。 I have 3 objects in an MDR: 我在MDR中有3个对象:

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

Object_1 = meeting types and budget 对象_1 =会议类型和预算

Object_2 = attendees at each meeting and money spent on each. 对象_2 =每次会议的与会者以及每次会议的花费。

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. 每次涉及obj_2中的联系人的记录被更新时,只有在去年召开会议的情况下,才需要更新contact对象中的字段。

How do I do this? 我该怎么做呢? Workflows? 工作流程? Formulas? 公式?

This can be accomplished by a workflow or an Apex Trigger. 这可以通过工作流程或Apex触发器来完成。

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 如果Obj2是发起更改的对象,请选择
  • Choose a name for the rule such as 'Update contact on Obj2 update' 选择规则的名称,例如“在Obj2更新时更新联系人”
  • 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())). 通过从“规则标准”部分的下拉框中选择“公式计算为真”,并在公式编辑器中编写类似以下内容的方法,来指定何时执行工作流的条件: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 在下面的“指定新字段值”部分中,选择“使用公式设置新值”,然后在Obj2中输入指定预算的字段名称,例如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 问候,lenin_ra

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM