Search code examples
dynamics-crmcrmunified-service-desk

USD - Pass Data through FireRequestAction


I am stuck in this small issue and as I am new to Microsoft usd therefore I require a bit of help to go through this.

I am trying to pass data from my Xaml.cs code inside USD Action Call but I am unable to do it. I have tried many solutions, below are some.

Object actionData;
 actionData = "CustomerID =D*****-****-****-****-***********";
 actionData = GeneralFunctions.Serialize(actionData);
 FireRequestAction(new RequestActionEventArgs(USDHostedControl, USDAction, actionData));

I have also tried like below,

 actionData = new Dictionary<string, string> { { "CustomerID", "D*****-****-****-****-***********" }};
  actionData = GeneralFunctions.Serialize(actionData);
  FireRequestAction(new RequestActionEventArgs(USDHostedControl, USDAction, actionData));

And inside my USD Action Call I am passing like this,

customerid=[[CustomerID]]

But unfortunately, none of it is working. I hope anyone here can help me with this.

Many thanks in advance.


Solution

  • Try this,

    var ctx= Context.GetContext();
    var context = new Context(ctx);
    context["CustomerID"] = "D*****-****-****-****-***********"";
    FireRequestAction(new RequestActionEventArgs(USDHostedControl, USDAction, context));
    

    And then inside your Action Call get the value using $Context.