Classes and interfaces

In this section, each class and interface of the concept will be explained in details.

Kipon.Xrm.Attributes.OutputAttribute

The [OutputAttribute] attribute is added to any property of a generated action response class. If you registre actions to be generated, an interface representing the input parameters will be generated, and a response implementation, with properties for each output parameter will also be generated. Each property in the generated output class will be decorated with the output attribute to allow the framework to take the value of the property and add it to the Dynamics 365 CE SDK plugin context output parameters


namespace Kipon.PluginExample.Plugins
{
    public class AccountCountContactsPlugin : Kipon.Xrm.BasePlugin
    {
        public Actions.AccountCountContactsResponse 
            OnPostkipon_AccountCountContacts(Actions.IAccountCountContactsRequest request)
        {
            return new Actions.AccountCountContactsResponse 
            { 
                Count = 10, 
                AMoney = new Microsoft.Xrm.Sdk.Money(500M) 
            };
        }
    }
}

Above plugin is listening for the kipon_AccountCountContacts, on post, and is returning an instance of Actions.AccountCountContactsResponse. The later is generated by the Kipon.Solid crmsvcutil extensions and has a property for each output parameter defined by the action. Each of these properties are decorated with the [output] attribute.

You will never need to use this attribute explicitly in your code. It is only used by code generated code.

As for output in Dynamics 365 CE actions, remember that it only make sense to set context OutputParameters values in POST stage, if you set it in validate or pre state, the values will not make it to the client, and if you set it in async, no one will be there to receive the response. The consequence is that returning a response instance from an action plugin step that is not in POST stage, does not really make sense at all.

© Kipon ApS 2020, 2021, 2022, 2023. All content on the page is the property of Kipon ApS. Any republish or copy of this content is a violation. The content of this site is NOT open source, and cannot be copied, republished or used in any context without explcit permission from the owner.