Changing Maintenance Modes via URL Parameters

 

When you utilize a Single Record Maintainer, you can set the default mode of the application to be either Add, Update, or Delete. But what if you want an application to add and update, for instance, based on what link a user clicks? Rather than making three separate applications, you can control the action of the maintenance application based on the parameter you pass to it.

For this example, we will utilize M00100s in Data Dictionary HURCKES.

After building a basic application, we can enter m-Painter and click the "Application Properties" button.

Under the "Program Options" tab, you can see we have a parameter titled "default_mode".

Here it has been set to add mode.

Running the application:

We see that we are in standard "Add" mode for data entry. However, I can modify the URL so that I can directly access this Maintainer in Update mode. In essence, I am overriding the "default_mode" at run time.

Rather than running the application as HURCKES.M00100s, I will now run it as HURCKES.M00100s?action_mode=UVK&CUSNO=222223, resulting in this screen:

Notice that this link automatically called the application, pulled back the record where the key field (CUSNO) was equal to "222223" and now allows me to update any field other than the key field.

You have many other options, as well, including prompting a user to enter in data or to perform the data change directly via email. See the below directions:

action_mode required:

 

ADD

UPDATE

DELETE

Prompt

AVK&slnk=1

UVK

DVK

Perform

AUR

URD

DDR

Prompt, Add mode

For example, adding a record in while passing values:

HURCKES.M00100s?action_mode=AVK&slnk=1&CUSNO=9999&CNAME=ZTrikes

Perform, Add mode

For example, adding a record via a single click:

HURCKES.M00100s?action_mode=AUR&CUSNO=9999&CNAME=ZTrikes

Prompt, Update mode

For example, updating a specific record:

HURCKES.M00100s?action_mode=UVK&CUSNO=9999

Perform, Update mode

For example, updating via a single click:

HURCKES.M00100s?action_mode=URD&CUSNO=9999&CNAME=ABikes

Prompt, Delete mode

For example, delete a record, confirm with user first:

HURCKES.M00100s?action_mode=DVK&CUSNO=9999

Perform, Delete mode

For example, delete a record in one click:

HURCKES.M00100s?action_mode=DDR&CUSNO=999

Note: Parameter names are governed by HTML laws, which require case sensitivity — "CUSNO" is different than "cusno".

One Step Mode (Hiding the Maintenance Display)

So far we have dealt with how you call the maintainer and then allow for the user to type in new values in any fields that they choose. We may wish to call the maintainer and pass the new values for the update fields to the maintainer, asking it to execute the update directly for us, without even displaying its screen to the user.

One of the hyperlinks described above to update a record currently looks like this:

HURCKES.M00100s?action_mode=URD&CUSNO=9999&CNAME=ABikes

To make it automatically carry out the update we need to add the following to the end of the hyperlink string:

&one_step=1&all_redir=HURCKES.I00001s

The whole string now looks like this:

HURCKES.M00100s?action_mode=URD&CUSNO=9999&CNAME=ABikes&one_step=1&all_redir=HURCKES.I00001s

These additional parameters are as follows:

one_step=1

This instructs the maintainer to execute the update in one single step, without showing us any screens.

all_redir=HURCKES.I00001s

This instructs the maintainer where to redirect after it has completed the update. In this case it is redirecting to a retriever, but it could be to any page that you choose.

Created: February 29, 2008 | Modified: August 21, 2013