Mendix SDK 4.0 - qualifiedName replacement

2
Hello everyone, I've noticed the loss of the qualifiedName function for e.g. Microflows (SDK 3.x => 4.x).  I have also noticed 'structureTypeName' as a typeName function. This of course doesn't produce the same result.  I'm asking for a quick way to extract the name out of a microflow object without the use of qualifiedName for the Mendix SDK 4.0+ In my case for the microflowAction class. Thank you in advance!
asked
4 answers
3

Model SDK 4.0 contains several breaking changes when upgrading from 3.x. This has been detailed in the release notes.

The 'qualifiedName' property only remains on objects that actually have a 'name' property themselves. On other objects, it makes no sense to have a 'qualifiedName' property, as it always returns the qualified name of the first parent object that has a name.

What you are trying to accomplish w.r.t. the 'MicroflowAction' class? Microflow actions do not have names, so their 'qualifiedName' property would just have returned the qualified name of the containing microflow.

Another breaking change in Model SDK 4.0 is that the 'typeName' property of classes and objects has been renamed to 'structureTypeName' to prevent a name clash in one specific class in the SDK. Other than the name change, these properties still return the same values as in 3.x.
 

answered
1

Hey Jermaine,

If I look at the docs I can still see Qualified name as a property for the microflow interface, or is that not what you mean?

https://apidocs.mendix.com/modelsdk/latest/interfaces/microflows.imicroflow.html#qualifiedname

 

answered
1

@Jermaine You can use the parent container property to walk up the tree and find the nearest parent that contains a qualifiedName.  An example how you could do this can be found below. Introducing such a helper function should help preventing a big refactoring in your codebase.

function getQualifiedName(element: IStructure) {
    const currentElement = element as any;
    if (currentElement.qualifiedName) {
        return currentElement.qualifiedName;
    } else if (element.container) {
        return getQualifiedName(element.container);
    } else {
        throw new Error("Unable to find qualifiedName");
    }
}

 

answered
0

@Adnan not entirely, i'll elaborate. 
@Benny I have read the changes in the release notes. Let me elaborate my situation. 

I have an Mx SDK program which makes use of qualifiedName to retrieve a microflow name, page name, entity name, module name etc.  This could be connected to a page button, formbase, microflow action, attribute, acces rules and many more. 

Before the update I shipped all the relevant information to an Abstract Model (which also used qualifiedName in 3.X). With Abstract Model I could easily retrieve the microflow-, page-, entity-, module name etc. 

Now with update 4.0 this route is impossible, and I feel like I have to refactor a lot of code. I was hoping to find a quick solution to this problem. I will double check if I can find an alternative, and if any of you know anything I would love to hear it. Before I start my refactoring process.

answered