How to get ListActionValue to work with a Pluggable Widget

0
Hi, I’ve been breaking my head over this piece of documentation for a while now: I can’t get it to work. For some reason when I try to execute the ActionValue that is returned from a ListActionValue call in my pluggable widget, it does not execute. The CanExecute boolean is set to false, but I just can’t seem to figure out why. It works just fine when I try to use a microflow without a parameter. But the moment I add a parameter it doesn’t work.  This is my piece of code: I’m assuming that it can’t execute because the object I’m giving it isn’t available. But, even by adding in those checks above it still can’t execute.  Anyone have an example of how this is used correctly?
asked
3 answers
0

I have this working in a widget of mine, but not sure if it is exactly the same scenario. I load items via a datasource (this.props.dsObjects) in the XML. In the render function I check first whether the items are available then for one of those items (let's say the first, items[0]) I want to call the microflow (this.props.int_onClick) as configured by the widget. This is how it looks and how it is working for me, the first Mendix object is fed to the microflow:

const datasource = this.props.dsObjects;
if (datasource && datasource.status == ValueStatus.Available && datasource.items) {
  // call the microflow as configured in the widget settings
  this.props.int_onClick(datasource.items[0]).execute();
}

My first check would be; are these items actually available yet? If so, try adding console.dir(datasource.items) to your code just before you want to execute the microflow. It could be the objects are not retrieved at all.

 

Good luck!

answered
0

Thanks Ivo, but copying the way you have it implemented code doesn’t seem to work for mine. I also have a question about it. See my comment on your answer for a question about your if statement. 

As for using console.dir() to check if the items are available. I did that and it looks like they are:

Interestingly, I did get it to work if I had a data view as context object for my pluggable widget (although this won’t work for my purpose). So it seems like my pluggable widget does not like using it’s own data?

answered
0

Okay… After hours of debugging, I found out why it didn’t work. I can’t explain it, but this is definitely the cause. 

Apparently if you include the Label Property Group, it breaks.

<propertyGroup caption="Label">
    <systemProperty key="Label" />
</propertyGroup>

For some reason ListActionValue returns an ActionValue with CanExecute=FALSE whenever you add the PropertyGroup “Label”. 

I have no idea why… @Ivo what happens when you enable the “Label” feature? Do you get the same results?

If so, this seems like a bug and should probably be reported.

answered