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
Tanmay KansaraTanmay Kansara 

set workflow/outbound message for all changed contacts

Hello All
I am trying to set a workflow trigger to send an outbound message for when any contact is changed. I could not find anything in criteria to let me set such a null condition so that I can select the "created, and any time it's edited to subsequently meet criteria" and leave the criteria blank. 

Essentially I would like to trigger a workflow message when any contact is created/modified.  
Thanks for your help.
Gustavo BertolinoGustavo Bertolino

You can create a trigger on Contact, pass as parameter 'before insert' and 'before update', because you want to fire such trigger everytime a contact is inserted or updated. In the trigger you can use to grasp all the new Contact records and store their IDs in a list. Later on you can create a method to do what you want and pass this list of IDs in that method. The method will execute the task of sending the email for all those contacts you passed in the method through their IDs. The following code is the skelectal/frame for tackling this issue. Disclaimer: I'm not 100% whether it works or not for your demand, but that's the implementation design which first came in my mind for this issue. I hope it can be helpful.

trigger TrgSendEmail on Contact (before insert, before update) {
    LIST<Id> listContactIDs = new LIST<Id>();
    for (Contact contact : Trigger.New) {
    if (listOfObjects.size() > 0) {

public class SendEmail {
    public static void sendingEmail (List<Id> contactIDs) {
        LIST<sObject> listToDoSomething = [SELECT Id FROM Contacts WHERE contactId IN: contactIDs];
        for (Contact contact : listToDoSomething) {
            if (contact.Id != null) {
                // send the outbound message;

Tanmay KansaraTanmay Kansara

The method seems like it will send an email?Would I be able to use it to send a notifcation to an end point? 

The idea is to Create a workflow action of they "New Outbound Message". This is supposed to send a ping to the specified endpoint. 
Gustavo BertolinoGustavo Bertolino
I don't know what would exactly be like the code line to do this task specifically.

For example, maybe you should pull a child object in the SOQL query and iterates over each Contact in the for loop to add such notification (it could be a field of this child object). After all, the trigger and method design is something like above. Now you have to work on this notification part and discover how to implement it in the method.