简体   繁体   中英

Send notifications in Dynamics CRM

I'm trying to send a notifications to a client (node.js) when a certain task occurs. For exemple, if an incident is created, it should send a notification to the client.

Is there a solution to do that in Dynamics CRM out of the box or do I have to write a specific plugin ?

Thanks for your help

A WebRequest can be used to easily HTTP POST something.

You can build a plugin assembly which would act as "dispatcher", and then register it where you need it. Note that you might have to put the assembly outside of the sandbox (Isolation mode: none).

You also can easily set it up for each registered step through the (un)secure configuration.

The linked MSDN page for WebRequest provides the following example:

public class WebRequestPostExample
{
    public static void Main ()
    {
        // Create a request using a URL that can receive a post. 
        WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");
        // Set the Method property of the request to POST.
        request.Method = "POST";
        // Create POST data and convert it to a byte array.
        string postData = "This is a test that posts this string to a Web server.";
        byte[] byteArray = Encoding.UTF8.GetBytes (postData);
        // Set the ContentType property of the WebRequest.
        request.ContentType = "application/x-www-form-urlencoded";
        // Set the ContentLength property of the WebRequest.
        request.ContentLength = byteArray.Length;
        // Get the request stream.
        Stream dataStream = request.GetRequestStream ();
        // Write the data to the request stream.
        dataStream.Write (byteArray, 0, byteArray.Length);
        // Close the Stream object.
        dataStream.Close ();
        // Get the response.
        WebResponse response = request.GetResponse ();
        // Display the status.
        Console.WriteLine (((HttpWebResponse)response).StatusDescription);
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream ();
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader (dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd ();
        // Display the content.
        Console.WriteLine (responseFromServer);
        // Clean up the streams.
        reader.Close ();
        dataStream.Close ();
        response.Close ();
    }
}

可以肯定的是,目前还没有这样的解决方案可用,因此您将要研究定制开发。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM