• Shawn Nguyen
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
We have a field on the Account calls Relationship_Manager__c that looks up to a contact record. We want whenever an opportunity is created, the same lookup relationship is created on the Opportunity record field calls Relationship_Manager__c. I know WF can't accomplish and that only a trigger would do. Can anyone help with the trigger and test code?
Thanks in advance!
Hi everyone, 

First attempt at writing a trigger and need some guidance. 

I have a custom Child object calls Account_Contact_Roles_c (not using the standard Salesforce b/c we want to see the related list on both the account and contact record) that tracks the account main contacts. We have a custom field on the contact record calls Contact Roles_c, which is a formula text field that pulls in the value from the Account_Contact_Roles_c's Role_c field. Using a WF rule with the following formula:

IF ( INCLUDES ( Roles__c , "Primary Contact" ), "Primary Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Key Contact" ), "Key Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Billing Contact" ), "Billing Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Sponsor Contact" ), "Sponsor Contact: ",null )

Whenever the contact role is updated in the custom object, the field on the contact record will update to reflect the new value. Thus if Primary & Sponsor are seleted in Role_C, Contact_Roles_c will have the value Primar Contact: Sponsor Contact.

However, we want the Contact_Roles_c field to clear out when the Account Contact Role record is deleted. I know WF can't accomplish this and only trigger can. Hope someone can point me in the right direction.

Thanks!
We have a field on the Account calls Relationship_Manager__c that looks up to a contact record. We want whenever an opportunity is created, the same lookup relationship is created on the Opportunity record field calls Relationship_Manager__c. I know WF can't accomplish and that only a trigger would do. Can anyone help with the trigger and test code?
Thanks in advance!
Hi everyone, 

First attempt at writing a trigger and need some guidance. 

I have a custom Child object calls Account_Contact_Roles_c (not using the standard Salesforce b/c we want to see the related list on both the account and contact record) that tracks the account main contacts. We have a custom field on the contact record calls Contact Roles_c, which is a formula text field that pulls in the value from the Account_Contact_Roles_c's Role_c field. Using a WF rule with the following formula:

IF ( INCLUDES ( Roles__c , "Primary Contact" ), "Primary Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Key Contact" ), "Key Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Billing Contact" ), "Billing Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Sponsor Contact" ), "Sponsor Contact: ",null )

Whenever the contact role is updated in the custom object, the field on the contact record will update to reflect the new value. Thus if Primary & Sponsor are seleted in Role_C, Contact_Roles_c will have the value Primar Contact: Sponsor Contact.

However, we want the Contact_Roles_c field to clear out when the Account Contact Role record is deleted. I know WF can't accomplish this and only trigger can. Hope someone can point me in the right direction.

Thanks!