You need to sign in to do that
Don't have an account?

Help with a Trigger
Dear all,
thank you in advance for you help.
i have a new custom object called Meetings.
then I have a Join object called Meeting Participants, that links Contacts to Meetings.
I would like to ensure that the meeting also show in the Account of the Contacts selected as Meeting Participants.
I need a trigger that automatically puts the selected contact's account in the Account field that I have in the Join Object.
Workflow dont seem to help here as the target field is a lookup.
I could look into process builder but I think a simple trigger should work.
i am purpously not using activities as we need several rich text fields on the Meeting Record and need to use SDoc or Conga to generate and print documents of the meeting.
Would anyone help me with the trigger creation??
thanks,
Leonardo
thank you in advance for you help.
i have a new custom object called Meetings.
then I have a Join object called Meeting Participants, that links Contacts to Meetings.
I would like to ensure that the meeting also show in the Account of the Contacts selected as Meeting Participants.
I need a trigger that automatically puts the selected contact's account in the Account field that I have in the Join Object.
Workflow dont seem to help here as the target field is a lookup.
I could look into process builder but I think a simple trigger should work.
i am purpously not using activities as we need several rich text fields on the Meeting Record and need to use SDoc or Conga to generate and print documents of the meeting.
Would anyone help me with the trigger creation??
thanks,
Leonardo
No, the trigger in the first post only handles the insert operation, not an update. To handle the case where the Account changes, you would need to add a bit of extra logic:
To answer your test question, yes, you would need some test class to test your Meeting_Participant__c logic if you went the trigger route. (You don't need one if you go the process builder route, fyi). For test code coverage, you need code coverage > 0% on triggers, and at least 75% across all apex classes in your org. However, you should always shoot for 100% code coverage on all your apex classes and triggers.
All Answers
Would this handles also if a user click on the join record and changes the Contact to another one in a different Account?
To then deploy this would I need a test class??
Thanks in advance.
Leonardo
No, the trigger in the first post only handles the insert operation, not an update. To handle the case where the Account changes, you would need to add a bit of extra logic:
To answer your test question, yes, you would need some test class to test your Meeting_Participant__c logic if you went the trigger route. (You don't need one if you go the process builder route, fyi). For test code coverage, you need code coverage > 0% on triggers, and at least 75% across all apex classes in your org. However, you should always shoot for 100% code coverage on all your apex classes and triggers.
Also a question, doing the trigger if I select 2 contacts from the same Account, in the Account record I will see 2 records in the related list for the same meeting (this is because the Join shows the Contacts records associated to the Meeting). is there a way in the related list to "group" the record by meeting thus not showing multiple records? is that a visual force page?
Thanks!
L