[4.0.4.0] - How to debug a Send Email Trigger?

Posted by IramK on 02-Jun-2016 03:31

Hello,

I have a send email trigger that would send an email after a record is created and I am using a token as provided by Rollbase from the dropdown as my email address that needs to receive this email. I have tried quite a few times now but it just doesn't send the email to that email address, however if I change the token to something else or provide a hardcoded email address value, it works. Not sure if there's something I'm doing is not right.

{!R103128.R103154.email} // This is the one I want that needs to work - doesn't work

{!R103117.R12198.email} // This is another relationship that has an email address - works

Posted by Rajkumar Mateti on 07-Jun-2016 05:27

Hi IramK,

After adding Embedded Quick create did not get the email, But after updating the timing to On Finalize it ran successfully.

We should use 'On Finalize' timing instead of 'After Create' timing if you want to get the current related record context which is created using Embedded Quick create or Grid control in create pages.

Thanks,

Rajkumar

All Replies

Posted by Anoop Premachandran on 03-Jun-2016 06:06

Can you share the cardinality of the relationships (One to One, Many to One) ?

Are they different in the cases that work and doesn't work ?

Posted by IramK on 03-Jun-2016 06:20

Hello Anoop,

Yes it is different but the dropdown gives me both the options, so I'm guessing I can use either.

So for the one that works:

{!R103117.R12198.email} - Cardinality is: Many-One (R103117),  One-Many (R12198) and then an email field in the many object.

The one that doesn't work:

{!R103128.R103154.email} - Cardinality is: One - Many(R103128), Many-One (R103154) and then an email field in that one object.

Let me know if you need any further information.

Iram

Posted by Anoop Premachandran on 03-Jun-2016 09:25

Will get back on this after some testing..

Posted by IramK on 03-Jun-2016 09:44

Sure Anoop. I shall wait for your response.

Cheers.

Iram

Posted by Rajkumar Mateti on 07-Jun-2016 00:34

HI Iramk,

I have tried the scenario you mentioned it seems to be working fine. Can you verify the steps i followed or same as you did. And let me know if i miss anything.

1) Create 3 objects A,B and C with Contact property enabled.

2) Created relationship as follows One A to Many B and Many B to One C

3) Created an Email template  in A object and Send email trigger and used the token from drop down (Bs:Cs: Email Address) which is {!R8414.R8554.email}. Email trigger is configured with After create timing.

4) Created a record in C with valid value in Email field

5) Created a record in B and selected the record created in C for C lookup in B object create page

6) Now created a record in object A and selected the record created in B for B lookup in A  create page.

Observed that got the email to the value given in C object email address.

Thanks,

Rajkumar

Posted by IramK on 07-Jun-2016 04:40

Hello [mention:7a3777c14de749d7b0cd7c5edeadbadb:e9ed411860ed4f2ba0265705b8793d05],

Thanks for the answer. There is a slight change in the condition. Lets call A as 'accounts', B as 'tickets', C as 'ticket Contacts' and D as 'contacts' (this is where the email field is that I want)

A - B - One to Many

B - C - One to Many (R103128)

C - D - Many to One (R103154)

I am creating the Send Email trigger in B i.e. tickets. 

Now the tricky bit: When I create a new B ('tickets') record, I have an embedded Quick create for C('ticket contacts') that has the lookup for D('contacts').

So technically the email field that I want is in D, and I am getting the email token from the "Use Field" dropdown as mentioned before as - {!R103128.R103154.email}. So when I create the new B record, a C record is created as well along with it through its embedded quick create where a D record selected.

Trigger: After create

Could you try this scenario above and let me know if it still works?

Cheers.

Iram

Posted by Rajkumar Mateti on 07-Jun-2016 05:27

Hi IramK,

After adding Embedded Quick create did not get the email, But after updating the timing to On Finalize it ran successfully.

We should use 'On Finalize' timing instead of 'After Create' timing if you want to get the current related record context which is created using Embedded Quick create or Grid control in create pages.

Thanks,

Rajkumar

Posted by IramK on 07-Jun-2016 05:32

Hello Rajkumar,

Thanks for your reply. So do we use After Create and On Finalize together? How does the trigger know when to send the email i.e. After Create or After Update? I'm just going to post a discussion about it in this forum to get a detailed reply for "On Finalize". I shall try that out and get back to you.

Thanks.

Iram

This thread is closed