LightningFlowComponents icon indicating copy to clipboard operation
LightningFlowComponents copied to clipboard

SendBetterEmail v2.2.1 - Error When trying to send emails to Users from a Lightning Template

Open bottomlinebrokers opened this issue 3 years ago • 7 comments

I am building a collection of Lightning Email templates that I send to Leads, Accounts (I'm a person Accounts org), and I want to send emails to my Users as well.

Because I use Lightning Email Templates, I must enter a Recipient Record Id here:

SBM

in the Recipient Record Id field.

I have not been successful doing this with a User Record ID in this field. When I attempt that, I get a FlowApplication error on SBM -- “nullError Code:INVALID_ID_FIELD - WhatId is not available for sending emails to UserIds.” Lead RecordIDs and Account RecordIDs work just fine.

The SendBetterEmail page states you CAN send to a User by entering a a UserID in this field...

"Recipient Record Id (also for template merge fields and recording related Email as an activity) Required if using a template. The ID of the contact, lead, or user to which the email will be sent."

Stuck on a project until I get past this...please advise.

bottomlinebrokers avatar Dec 24 '21 02:12 bottomlinebrokers

See SendBetterEmail - Unable to send Lightning templates to users #788 Last comments.

One workaround we've seen used in the past is to create a dummy record. While WhatId must be specified for lightning templates, if you give it a dummy, even though you never use the merge fields from the dummy, it seems to work.

Does this help?

jdpond avatar Dec 24 '21 03:12 jdpond

Jack,

Thank you SO MUCH for the rapid response!

Until now, I have been creating a dummy personAccount using the necessary information, and then deleting that record in the same flow.

However, that trick won't work anymore, because a combination of:

1 -I'm sending out multiple emails at the same time to the same users, and my flow is reasonably bulkified (I filter for the target records in the start element of my scheduled flow). This means the flow processes all my emails in bulk...and 2 - I have PersonEmail uniqueness on my personAccounts, so I can't create multiple records with @.***" (for example) for the dummy Account.

The documentation on unofficialsf should be updated, that's why I kept pounding my head against it....I assumed the error was me!

Any workaround or possibility of improvement to SBM? My developer took a peek at the code and made the following comments...I share in the spirit of exchanging ideas...


The code that you downloaded and are using now uses the method setTemplateID() to use a template. When used like that, the WhoId and WhatId limitation kicks in. You can use a method called renderStoredEmailTemplate(), that one take any object as WhatId, and WhoId can even be null, all you have to do instead using Recipient, just add the name of the recipient to the Email passin object you have, then you don't need a WhoId.

Please advise any ideas or thoughts.

Thank you for your contributions to the community! I wish I developed sometimes.....ok, many times... 🙂

Mark


From: Jack D. Pond @.> Sent: Thursday, December 23, 2021 7:43 PM To: alexed1/LightningFlowComponents @.> Cc: Mark Pieter @.>; Author @.> Subject: Re: [alexed1/LightningFlowComponents] SendBetterEamil v2.2.1 - Error When trying to send emails to Users from a Lightning Template (Issue #998)

See SendBetterEmail - Unable to send Lightning templates to users #788https://github.com/alexed1/LightningFlowComponents/issues/788 Last comments.

One workaround we've seen used in the past is to create a dummy record. While WhatId must be specified for lightning templates, if you give it a dummy, even though you never use the merge fields from the dummy, it seems to work.

Does this help?

— Reply to this email directly, view it on GitHubhttps://github.com/alexed1/LightningFlowComponents/issues/998#issuecomment-1000635034, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKNO7TGZGMCHJNB7CDORCDTUSPT7VANCNFSM5KV3W6DQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

bottomlinebrokers avatar Dec 24 '21 04:12 bottomlinebrokers

I'll investigate an enhancement to SBE with renderStoredEmailTemplate in the next few days. However, as an interim, you do not have to create a new dummy account for each in your bulk. You can create a single dummy and then use a loop to create a list of accounts - even though each in the list is the same. As long as you have 1 for 1 in the list of targetObjectId and whatIds (list counts are equals), they are required to be neither unique or non-duplicate.

jdpond avatar Dec 24 '21 05:12 jdpond

Jack,

Thank you so much. If I can contribute in any way whatsoever (short of coding! 🙂 ), please don't hesitate to let me know!

Mark


From: Jack D. Pond @.> Sent: Thursday, December 23, 2021 9:46 PM To: alexed1/LightningFlowComponents @.> Cc: Mark Pieter @.>; Author @.> Subject: Re: [alexed1/LightningFlowComponents] SendBetterEamil v2.2.1 - Error When trying to send emails to Users from a Lightning Template (Issue #998)

I'll investigate an enhancement to SBE with renderStoredEmailTemplate in the next few days. However, as an interim, you do not have to create a new dummy account for each in your bulk. You can create a single dummy and then use a loop to create a list of accounts - even though each in the list is the same. As long as you have 1 for 1 in the list of targetObjectId and whatIds (list counts are equals), they are required to be neither unique or non-duplicate.

— Reply to this email directly, view it on GitHubhttps://github.com/alexed1/LightningFlowComponents/issues/998#issuecomment-1000666928, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKNO7TFFS3I2DOJ76OR4KO3USQCJ5ANCNFSM5KV3W6DQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

bottomlinebrokers avatar Dec 24 '21 05:12 bottomlinebrokers

Jack,

Good morning! Hope you had an excellent holiday.

Any update on the feasibility of enhancing SBE?

Mark


From: Jack D. Pond @.> Sent: Thursday, December 23, 2021 9:46 PM To: alexed1/LightningFlowComponents @.> Cc: Mark Pieter @.>; Author @.> Subject: Re: [alexed1/LightningFlowComponents] SendBetterEamil v2.2.1 - Error When trying to send emails to Users from a Lightning Template (Issue #998)

I'll investigate an enhancement to SBE with renderStoredEmailTemplate in the next few days. However, as an interim, you do not have to create a new dummy account for each in your bulk. You can create a single dummy and then use a loop to create a list of accounts - even though each in the list is the same. As long as you have 1 for 1 in the list of targetObjectId and whatIds (list counts are equals), they are required to be neither unique or non-duplicate.

— Reply to this email directly, view it on GitHubhttps://github.com/alexed1/LightningFlowComponents/issues/998#issuecomment-1000666928, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKNO7TFFS3I2DOJ76OR4KO3USQCJ5ANCNFSM5KV3W6DQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

bottomlinebrokers avatar Dec 29 '21 17:12 bottomlinebrokers

Jack,

Good morning! Any update on the feasibility of enhancing SBE?

Thank you kindly,

Mark


From: Jack D. Pond @.> Sent: Thursday, December 23, 2021 9:46 PM To: alexed1/LightningFlowComponents @.> Cc: Mark Pieter @.>; Author @.> Subject: Re: [alexed1/LightningFlowComponents] SendBetterEamil v2.2.1 - Error When trying to send emails to Users from a Lightning Template (Issue #998)

I'll investigate an enhancement to SBE with renderStoredEmailTemplate in the next few days. However, as an interim, you do not have to create a new dummy account for each in your bulk. You can create a single dummy and then use a loop to create a list of accounts - even though each in the list is the same. As long as you have 1 for 1 in the list of targetObjectId and whatIds (list counts are equals), they are required to be neither unique or non-duplicate.

— Reply to this email directly, view it on GitHubhttps://github.com/alexed1/LightningFlowComponents/issues/998#issuecomment-1000666928, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKNO7TFFS3I2DOJ76OR4KO3USQCJ5ANCNFSM5KV3W6DQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

bottomlinebrokers avatar Jan 10 '22 18:01 bottomlinebrokers

Jack,

It's been a while. Any update on the possibility of enhancing SBE with this?

Thank you!

Mark

bottomlinebrokers avatar Mar 29 '22 22:03 bottomlinebrokers