Skip to main content

Dynamic Page Redirects in Intrexx

· 4 min read
Eduard Bunescu
Eduard Bunescu
Low Code Developer

There are many applicable real-life scenarios where the destination page must sometimes be different upon the click of a button. Imagine the same button being clicked to determine what the destination page should be on its own. How to do this Intrexx?

All you need is the application GUID of our desired page, a record ID, and a page title that should be as unique as possible!

Let's imagine the following scenario:

We have a ticket management application in Intrexx where users can create tickets for specific applications that encounter various issues. The user will create the ticket, and based on the application the ticket was created from, we save the application GUID, as this is the most important part, and the record ID. Then, imagine the ticket management support agent will see the ticket, and on a "Ticket Details" page, we have a button named "Record Details".

Upon clicking this button, the details page mentioned at the beginning of this post will be chosen automatically, and the intended information will be displayed!

Now imagine the user creating a ticket from a different application. The exact same thing will happen. The same button with no "hardcoded" code will determine by itself where it should redirect.

This is how we achieved this:

  1. Open an application and create a details page inside a data group with the fields you intend to display that will be useful to the support agent.
  2. Give the page a name like "TICKET_MANAGEMENT_DETAILS_PAGE".
  3. Repeat steps 1 and 2, but in different applications, as many times as you want. It's really important to note that this approach supports only a single details page per application.
  4. Go to the Ticket Management application (the application we used as an example where this could be useful) Now, on the initial ticket details page, on the button that should open the details page, call the following JavaScript function:
function checkReferenceRedirectExists(applicationGUID, recordID, elGUID){
// applicationGUID => parameter that represents the application GUID of where the ticket was created from, by the user
// recordID => the record ID
// elGUID => a random element GUID used for the loading animation
var el = getElement(elGUID);
ix.ajax().requestAppGroovy("checkReferenceRedirectExists.groovy", {
dataType: "json",
data: {
"applicationGUID": applicationGUID
},
success: function (data) {
const pageGUID = data["pageGUID"];

ix.loader.tooltip({
ixApp: {
guid: applicationGUID,
pageGuid: pageGUID,
recId: recordID
},
windowSettings: {
position: "modal",
dragAble: true,
closeByButton: true,
closeByEsc: true,
title: false,
width: 1200
},
});
},
ixWaitAnim: {
element: el,
type: "overlay"
}
}, el);
}
  1. Next, create a Groovy file named checkReferenceRedirectExists and add the following snippet to it
response.json()

response.onError = {e, err ->
err.title = "my error"
err.description = e.message
err.showEmbedded = true
}

def conn = g_dbConnections.systemConnection

def applicationGUID = g_request.get("applicationGUID")

// TICKET_MANAGEMENT_DETAILS_PAGE is the name of the pages, used to display details for records. this MUST be set the same
// this SQL snippet will join a couple of datagroups, that contain the page details, where we can look up by the page name, if we know what application the page belongs to!
def pageGUID = g_dbQuery.executeAndGetScalarValue(conn, """SELECT LCAPPFUPTITLE.STRFUPGUID
FROM LCAPPFUPTITLE
JOIN LCAPPFUP
ON LCAPPFUP.STRGUID = LCAPPFUPTITLE.STRFUPGUID
WHERE LCAPPFUPTITLE.STRITEM = 'TICKET_MANAGEMENT_DETAILS_PAGE'
AND LCAPPFUP.STRAPPGUID = ?
AND LCAPPFUPTITLE.STRLANG = 'en'
""", null) {
setString(1, applicationGUID)
}

writeJSON("pageGUID": pageGUID)
  1. And that's it! Your button will automatically redirect the user to the intended page without having a long hardcoded list of page GUIDs based on criteria that always need to change when adding new supported applications.
  2. Remember to add page permissions as well! :)

Hopefully this will be of use to you!