• ajbtv2
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I need some assistance bulkifing a trigger.

 

I have been tasked with setting up a Fulfillment Email trigger that notifies end users when an Asset has been shipped.

 

I have found I need to use the SingleEmail method due to needed to Mail Merge Asset Fields.

 

The system must identify the contact on the Asset, the Contacts in a group associated to the Asset, the contacts on the account requesting all notices sent, and if a web fulfillment all users in the Public Group associated to the account.

 

The trigger works well if I am updating a single record at a time.  I run into issues when my vendor asset also updates all associated records for other accounts giving me a 101 SOQL error.

 

I have been able to remove the error by updating out of the for loop, but the emails now only go to the first account (as expected) [0].

 

I have thought about running a schedule apex class, but if I can only send 2 or 3 notices at a time, that will take too long to complete.

 

Any assistance is greatly appriciated.  I have posted my WIP code below:

 

----- REMOVED CODE AS UPDATE IS AVAILABLE BELOW  ----- 

Hello All,

                 I am facing one problem in one Org in that org i have contact list.

                 Now when i am trying to send email to this particular contact it gives me error.

                 'List has no Row for assignment to SObject'

                 since i am selecting the transaction than also it gives me this error and when i checked it in my developer org it is working correclty.

                 Now the problem i found is the contact.To which contact i am sending the Email In that Contact Email it shows me Confirm Email Address .

                 So can anyone tell me how to know wheather this is confirmed email address to send email.Why it is showing me that confirm Email address though i have another user Email address of same smtp server.