HomeObject property

Official Content

HomeObject is a GAM Application object property that allows determining the object to which the Web application will redirect when a successful login has been done, but there's no object to redirect to. That is, when executing the GAMApplication.GoHome() or GAMRepository.ApplicationGoHome methods.

Summary

Example

The GAMExampleLogin object contains the following code, so when the login succeeds, and there is no URL to return, the GAMHome is automatically invoked.

    &LoginOK = GAMRepository.Login(&UserName, &UserPassword, &AdditionalParameter, &Errors )
    If &LoginOK
       &URL = GAMRepository.GetLastErrorsURL()//(*)
        If &URL.IsEmpty()
            GAMHome()
        Else
            Link(&URL)
        Endif
    Else
        /* code */
    Endif
    

The GAMHome object contains the following code, and the Home Object is automatically invoked, using the GAMApplication.GoHome() method.

    If GAMSession.IsValid(&GAMSession, &GAMError) and not &GAMSession.IsAnonymous
        &GAMApplication = GAMApplication.Get()
        If NOT &GAMApplication.HomeObject.IsEmpty()
            GAMApplication.GoHome()
        EndIf
    Else
        GAMExampleLogin()
    EndIf    

Where to configure the Home Object property

The Home Object is configured using the GAM API, or executing the GAM Web Backoffice.

Consider the following code to do it programmatically:

&Application.Load(&Id) //&Application is GAMApplication data type
&Application.HomeObject = &HomeObject
&Application.Save()
commit

Instead, execute the GAMBackend. Go through Applications Menu Item, General Tab, and enter the HomeObject value as the figure shows:

i2017_04_19_21_11_131_png

Considerations for the HomeObject value 

It can be an object of the KB or a URL. 

If it's an object, it has to be prefixed with the module where it's defined. The URL is set using the Environment Settings of the Application. Since GeneXus 15 upgrade 5, the URL can be absolute or relative depending on the UseAbsoluteUrlByEnvironment property value.
For previous versions, it's always relative and only the Package and Extension Environment settings were considered.

image_201763015621_1_png

i2017_04_19_21_17_572_png

Compatibility Notes

Previous to GeneXus 16 upgrade 8, when there wasn't any object to redirect after the login,it was redirected to the Home Object of the GAM Backend Application (which by default is set to the gamhome object). The gamhome objected redirected to the GAMExampleWWusers.

The gamhome object has suffered changes. Since GeneXus 16 upgrade 8, it uses the GAMApplication.GoHome() method to redirect. By default this value is not set. You have to configure it when you update the application to upgrade 8.

Therefore, the first time you execute the applicacion (the gamexamplelogin, or the gamhome) the following panel is shown where the user is asked to enter which is the Home Object.

image_202076165622_1_png