function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jay REIJay REI 

wokflow-alert-dynamic recipient reg

Hi
 
I have the following requirement.
 
Using an S-Control(devloped with AJAX and javascript), users will be inserting records into a custom object. Notification Flag is one of the fields in the custom object.
 
Whenever a new record is created into this object with the Notification Flag check box checked, I have to send an email to two users(these user ids can be part of the cusom object).
 
I know how to create workflow alerts, workflow rules, email templates etc., but in all these the recipients have to be a member of a public group or profile etc.,
 
In this scenario, any user, selected (stored in to the custom obeject) is a recipient.
 
So My question is, Is there a way to dynamically decide the recipient of an email?
 
Thanks
Jay
 
ApprivoApprivo

If you are inserting the records using a scontrol, then you know the userids and I suggest notifying the given users using the 'send email' directly in your code, and not using workflow

E.g.

//insert records, with userid 00530000000t1di and 00530000000ooxw on the records

if(Notification Flag)
   //get the email address for the two users by querying the user table

   //send an email to these users using the example given at
http://forums.sforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=699
}

 

Jay REIJay REI

Thanks,

It was very useful.

Jay