Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

how to prevent duplicate emails?

$
0
0

Hello - I'd like to add some code to ensure that CRM doesn't send duplicate emails, for example, 2 identical approval request emails to the same approver.  The following method exists in the codebase to route requests:

        public static void RouteTo(IOrganizationService serviceProvider, Guid requestId, Guid queueId)
        {
            var addToSourceQueue = new AddToQueueRequest
            {
                DestinationQueueId = queueId,
                Target = new EntityReference(Incident.EntityLogicalName, requestId)
            };
            serviceProvider.Execute(addToSourceQueue);                     
        }

Is there a way to modify this code to prevent duplicate email requests?  For example, could I add some code like this to the top of the method above?:

        //if requestid is already in queue then return
        //not sure how to use columnSet???
        var entity = serviceProvider.Retrieve(Incident.EntityLogicalName, queueId, columnSet);
        if(entity != null) return;


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>