Novitates Tech is committed to shaping a digital landscape that empowers businesses globally, offering accessible transformative solutions that ignite industry-wide change. Our dedication to innovation drives us to create strategies that redefine global business operations.
Get in touch
connect@novitatestech.com
+91 929-151-6231
209 Workafella Cyber Crown, Sec-II Village, HUDA Techno Enclave, Madhapur, Telangana, India 500081
As part of embedding a work case link in email, with Theme-Cosmos we have OOTB rules helping us with Correspondence fragments which dynamically generate the link.
However, with constellation the same approach might not work in a full-fledged manner leading to various anomalies. This is due to the reason that Constellation apps support semantic URLs by default. To launch a case using a URL, you should construct it using the semantic URL pattern supported by the Constellation UI.
The same problem statement has been highlighted in the below PDN article as well
This new semantic URL must be dynamically formed where below 3 steps must be handled,
The base URL until the appalias name must be dynamically formed with OOTB java code.
Case type name with additional “s” must be dynamically fetched
The portal name which is seen as the query string parameter must be parameterized to redirect users to the correct portal.
To encapsulate the above tasks into one rule, we can build a function rule with certain parameters that does all the heavy-lifting and returns us the URL as final output.
Reusable Function
Let’s call this function as “GetCaseLinkURL” which will intake 4 arguments as mentioned below,
tools – PublicAPI
caseID – pyID of your work case
className – pxObjClass of your case type
portalName – portal name where the case should be opened for viewing. If not passed, default will be “WebPortal”
As part of this function logic, below are the important tasks we are going to perform in detail.
Building base URL
We can use the OOTB class methods to build the base URL for the current application context using the below code
The above piece of code is already used in the OOTB correspondence fragment rules in Theme-Cosmos as well. Strangly, the piece of code highlighted in yellow works in Correspondence Fragment and Activity’s Java step but does not work in Function rule.
But without using these two lines we cannot fetch the current application context URL. So, we can write these two lines in a Java step in an activity in baseclass and call it in the reusable function we are building.
So, we have written an activity in baseclass with name “GetPublickLinkURL” as shown below,
Activity execution will build the URL and pass back the Public Link URL as out parameter which is fetched and used further.
This function will be called in the first of the function as shown below
The above activity can be named as per choice of naming convention. If we can figure out the way to build the public link URL based on the current application context in function itself, then we need not use this activity at all.
Fetching the Case type name
A new OOTB rule type is introduced in Constellation which is “Rule-UI-Routing” one per application which is created automatically once the application is created.
We have noticed that all the case type names are stored automatically in this rule type as and when the case types are generated. Also, this rule type plays a major role w.r.t to Constellation working methodology as well. Due to that it is recommended to generate this routing table using a button on the application rule, if the “pyRoutingTable” rule is not present in your application ruleset or not updated properly.
pyRoutingTable does not have a UI but it does have a JSON string in on the property named “pyRoutes” as shown below.
So, if we want to fetch the plural case type name dynamically, we must use the case type class as input and parse the JSON.
As part of the function, we open the pyRoutingTable instance and pull the JSON and parse it using Jackson API to fetch the caseName based on the className passed as parameter.
Using Portal name as parameter
PortalName is one of the parameters for the function which we have developed so that we can embed the same into the URL as a query string parameter. If no value is passed, then WebPortal is taken as a default.
Based on the above 3 elements, the final URL is formed and returned as output
Benefits of the function
This function would serve as one stop shop to fetch the URL throughout the application without the need to write additional java code to build the URL
As this function is parameterized with className, caseID and portalName, it can be used from anywhere in the application by passing appropriate values.
This function can also be extended to build the Theme-Cosmos URL pattern as well.
Function code
//Get the Param.PublicLinkURL out of this activity execution