locked
How to Get the Parameters in SetState Plugin RRS feed

  • Question

  • Dear All
          In Create and Update message I can get the Parameters from context.InputParameters. But In SetState I can not get any Parameters
          For example In appointment entity when fired SetState Plugin I want to get the StateCode Parameters and Some other Parameters(named A or B or C) in the record How can I get these Parameters
    Tuesday, May 20, 2008 9:16 AM

Answers

  • To get the state and status, use:

    (string) context.InputParameters["State"]

    (int) context.InputParameters["Status"]

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
    Monday, April 20, 2009 2:19 PM
    Moderator

All replies

  • Hi,

     

    I'm not 100% sure, but I believe that you will find three parameters inside InputParameters property, but the name of this parameter will vary depending of which entity the SetState message is for. For example, if the message is SetStateAccount you will find: AccountState, AccountStatus and EntityId. This parameters are the same as the properties that the SetStateAccountRequest has. So, for another entity the parameters will change the name depending on the request.

     

    Also, you can get the pre and post image of the entity that you register the plugin for. This will let you get all the attributes that you want from the entity before and after the set state operation.  Take a look to this thread http://forums.microsoft.com/Dynamics/ShowPost.aspx?PostID=3365683&SiteID=27

     

    Let me know if this works for you.

     

    Marco

     

     

    Tuesday, May 20, 2008 10:50 AM
    Moderator
  • Hi Marco:
    Thanks for you help now I can get the parameters by set pre/post image. I config the pre/post image under the pre/post step and in the code use context.PreEntityImages.Properties/context.PostEntityImages.Properties
    to get the
    parameters which I want. Most parameters is right but only the StateCode have some problem.

    You say
    I will find three parameters inside InputParameters property but in the step preSetState message for entity appointment I return the value context.InputParameters.Properties.Contains("Target") is False.
    InputParameters have no
    parameters I also return the OutputParameters/PostEntityImages also False Only the
    PreEntityImages is True. The problem is in PreEntityImages I can get the StateCode parameters but the Value is before the record ChangeState. IF I use postSetState message I can get the StateCode parameters by PostEntityImages this value is after record ChangeState but the record is also changestate.

    I want to judge the statecode parameters which the record will changed to before the record changestate. So I want to get the
    statecode which the record will changed to  in presetstate message. How can I get it in presetstate message

    Wednesday, May 21, 2008 3:37 AM
  • Thursday, May 22, 2008 10:39 AM
    Moderator
  • To get the state and status, use:

    (string) context.InputParameters["State"]

    (int) context.InputParameters["Status"]

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
    Monday, April 20, 2009 2:19 PM
    Moderator