cancel
Showing results for 
Search instead for 
Did you mean: 

Data Exchange between OpenUI control (WPF) and Agentry

Former Member
0 Kudos

Hi All,

I'm trying to implement a OpenUI add-in for the Windows (WPF) Agentry client which updates Agentry properties and calls an action. I'm having trouble understanding the OpenUI interface of the Windows Agentry client.

Scenario:

I've added a new property called ZTest of type String to the MainObject of Work Manager (6.1).

I've also added a new field ZOpenUITest of type "String" to the WorkOrderTileListView screen (it's basically shown below the order list)

In the ZOpenUITest screen field, I've set the Class Name to "MyStringEditAdapter", added "ZTestExternalValue" to the External Values list and I've added an action ZTestUpdate to the action list

I used the sample control project from the OpenUI SDK for WPF as a start and started playing around with the MyStringEditAdapter class. But I'm unclear on how to expose a string to the external value (ZTestExternalValue) and how to call the ZTestUpdate action. I'm able to debug into the code - so this is not an issue of getting the add-in running.

I tried something like this:

AgentryClientSDK.IAgentryControlViewModelStringEdit vm = DataContext as AgentryClientSDK.IAgentryControlViewModelStringEdit;

but it's returning null.

This returns a valid reference:

AgentryClientSDK.IAgentryControlViewModelStringDisplay vm = DataContext as AgentryClientSDK.IAgentryControlViewModelStringDisplay;

But I didn't find a way a way to expose the external values or trigger the Agentry action. For exposing the external values, I would assume there is an even which I need to implement.

Unfortunately the documentation on OpenUI for WPF is rather thin imho. I appreciate any input.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

kunal_mehta
Explorer
0 Kudos

Hi Christian,

1. Is the ZOpenUITest string field set as read-only? If so, you may need to uncheck that. That might be the problem for vm being null :

AgentryClientSDK.IAgentryControlViewModelStringEdit vm = DataContext as AgentryClientSDK.IAgentryControlViewModelStringEdit;


2. External Values - External Values are a way to pass data FROM open UI control TO agentry screen/action. To do that:

     a. Define an external value string, say , "myExtValue" in the External Values section in editor.

     b. Implement GetExtensionStirng(String key) method of ICustomAgentryControl interface.

          Public string GetExtensionString(string key){

          if(key.Equals("myExtValue"){

               Return “some string”;

          }    
      }

   c. In an agentry action/rule, when you access this external value field, Agentry will call your open UI control's GetExtensionStirng() method to ask for the value. This is the basic mechanism to get data from open ui to agentry.


3. Agentry Actions: Here, you can specify any Agentry action defined in your application to be called from OpenUI control. To run an agentry action , you would call: SMPActionResult result = viewModel.ExecuteAgentryAction(action);

    


Former Member
0 Kudos

Hi Kunal,

thanks a lot for pointing out the GetExtensionString method. I guess I was too blind to realize what it's for.

I got it working now.

Cheers

Former Member
0 Kudos

Kunal how do you pass FROM agentry TO openUI code?

kunal_mehta
Explorer
0 Kudos

To pass data from Agentry to OpenUI, one needs to define AgentryValues in eclipse editor. AgentryValues take a key-value pair (strings only). So sometimes, you may need to be creative to pass complex data

Former Member
0 Kudos

Ah I see cool, then whats the method inside the C# code to get that "Agentry Value"?

Former Member
0 Kudos

This?

AgentryClientSDK.IAgentryControlViewModel vm = DataContext as AgentryClientSDK.IAgentryControlViewModel;

string blob = vm.GetAgentryString("blobValue");

kunal_mehta
Explorer
0 Kudos

Yes.

Former Member
0 Kudos

And that can be anywhere in your custom control code right?

Thanks for the help and timely response btw.

Answers (0)