(FlowUI) Instance name inheritance from entities is not working

In Flow, I have the following two Entities and instances

Product: instance name “Style”
Sales Order: Instance name “orderNo”

and the instances show up in ComboBox nicely like as follows:
image

What is not working is when I have an instance of another Entity named “SalesOrderLine” which is using a composite instance name with Product and SalesOrder as follows:
image

But when I use this SalesOrderLine entity in a screen comboBox, it looks like the instance name is not properly working as expected, it shows like below, like there is no instanceName defined.

image

Hi,

Could you please attach a small demo project that reproduces the problem?

Hi Gleb
Please find attached a demo project that I have created to reproduce the problem.
You will see the instance name is working at the product level as you see it is nicely displayed in the SalesOrder screen:
image

and then I have created instanceName for Sales Order as below:

 @InstanceName
    @DependsOnProperties({"salesOrderNo", "product"})
    public String getInstanceName() {
        return String.format("%s %s", salesOrderNo, product);
    }

But This is not working in the Delivery screen where the instance name of sales order is partially inherited from the Product instanceName.

image

instanceNameDemo.zip (237.7 KB)

It is in fact working, as you can see from the fact that 2201 is rendered at the beginning.

In the method you are just using the toString method of the entity product. Since you did not override the method probably, it shows the default impl.

If you want to recursively calculate the instance name you have to pass in MetadataTools as a parameter into the method. Then you can use MetadataTools::getInstanceName and pass in the product.

Here is an example: rent-your-stuff/Order.java at main · mariodavid/rent-your-stuff · GitHub

Btw this is also unrelated to FlowUI.

Cheers
Mario

1 Like

Thanks, Mario for your comments and for sharing your code which I believe someone coded manually. What I would expect is, the studio generates it correctly as the instance name I have shared is generated by the Studio.

Hi,

Thank you for the demo project. I’ve create an issue. For now you can make the required changes manually.

Regards,
Gleb

1 Like