1
0
-1

Hi,

the Maestro API Reference mentions the above method.

I'm trying to implement that now, but having trouble specifying the target.

If I use the following code it redirects to the Forms Portal, it does not show the error page.

Forms.redirect("../error.htm")

or

Form.redirect("https://my.organisation.com.au/organisation/servlet/error.htm");


I am using this code in a page load rule; the rule calls a dynamic data service; the page flow is based on the response from the dynamic data call - if it is a 'reject" I want to redirect to the error page.

The API reference does not have a full example of how to use this method.

How do I target the error page?


Thanks

Mark

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Mark,

      Do you have your error page set up in the form portal? You can check the portal assigned to your form, find the error page (Forms/Form Spaces menu), and the url to it. There is where you need to redirect.

      Usually, if your form is in /web-plugin/ portal published, the error page (default) is https://yourTM/web-plugin/error.htm

      Regards,

      Julio.

      1. Mark Murray

        Hi Julio,

        thanks for the feedback. That is helpful.

        I managed to find the default error page for our organisation, based on the url you mentioned.

        In this scenario I am redirecting to the error page based on the result of a dynamic data call. The error page has some Velocity template parameters.

        Is it possible to pass a custom message or a flag to the error page?

        Or alternatively how do I create a new page with a specific message? The form spaces page does not have a 'New' button.


        Thanks

        Mark

      2. Mark Murray

        Hi Julio,

        another question:

        the url used for the above redirect is static, such as "https://ourTM/ourPortal/error.htm".

        Is it possible to make that dynamic, so that the error page is related to the environment where the form is published - the form needs to be published to our DEV, then UAT, then Production environments, so I need the url to be dynamic to match the environment.

        Can I capture the environment in the page load rule, or would I need to make it part of the dynamic data call response?


        Thanks

        Mark

      3. Julio Berrueco

        I usually take it from a DDS, but I believe document.URL or document.location.origin in your rule can work too. I'll ask and if I find better option for Maestro, will let you know.

        var baseURL = document.location.origin

        var redirectURL= baseURL + "/error.html"

      4. Mark Murray

        Hi Julio,

        thanks for the suggestions.

        I found that 'document.location.origin' gives me the base, then I need to add the portal and error page.

        So, I have:

        var base = document.location.origin
        var target = `${base}/myPortal/error.htm`
        Form.redirect(target)

        and that worked.

        I'll also look at using a DDS, but this seems to work for now, so that's a positive.

        Thanks

        Mark

      CommentAdd your comment...