Question

Show popup welcome message

Hi,

 

After login, show popup welcome message, it should be auto disappear after 10 seconds.

How to achieve this ?

 

Any help will be highly appreciable

 

Regards

Like 0

Like

1 comments

It's possible to implement the functionality by creating the replacing client module for "BaseIntroPageSchema" schema. Override the init method in the schema in order to show welcome message after login. Every time the IntroPage is loaded the message is shown. In order to show the message only after login please create the replacing object for "Contact" and add column that will save information about was message shown or not. Every time the user is logged in or logged out the column value should be changed.Please use client EntitySchemaQuery to check the column value and change it  when the message was shown.To change the column value when the user is logged out you can create a trigger on an update statement to the SysAdminUnit table the LoggedIn column.

Here is the example below:

define("BaseIntroPageSchema", ["BaseIntroPageSchemaResources", "MainMenuTileGenerator", "AcademyUtilities"],

    function(resources, MainMenuTileGenerator) {

        return {

            attributes: {},

        

            methods: {

                /**

                 * @inheritdoc Terrasoft.BasePageV2#onRender

                 * @override

                 */

                onRender: function() {

                    this.callParent(arguments);

                    

                },

                

                closeDialog: function(){

                    $(".t-btn-wrapper.t-btn-text.t-btn-style-blue").click();

                },

                /**

                 * @inheritdoc Terrasoft.BasePageV2#init

                 * @override

                 */

                init: function() {

                   

                    this.callParent(arguments);

                    this.showWelcomeMessage();

                },

                showWelcomeMessage: function(){

                    

                    let currentUserId = this.Terrasoft.SysValue.CURRENT_USER_CONTACT.value;

                    var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {

                        rootSchemaName: "Contact"

                    });

                    // Add column with name of main contact of accounts that refers to given contact.

                    esq.addColumn("UsrShowWelcomeMessage");

                

                    // Get one record from selection on the basis of [Id] of card object and display it 

                    // in an info window.

                    esq.getEntity(currentUserId, function(result) {

                        if (!result.success) {

                            // error processing/logging, for example

                            this.showInformationDialog("Data query error");

                            return;

                        }

                        if(!result.entity.get("UsrShowWelcomeMessage")){

                             this.showInformationDialog("Hello!");

                             setTimeout(this.closeDialog, 10000);

                             this.updateRecord(currentUserId);

                        }

                    }, this);

                  },

                  

                  updateRecord: function(contactId){

                      var update = Ext.create("Terrasoft.UpdateQuery", {

                        rootSchemaName: "Contact"

                    });

                     

                    update.filters.add("IdFilter", update.createColumnFilterWithParameter(

                        Terrasoft.ComparisonType.EQUAL, "Id", contactId));

                     

                    update.setParameterValue("UsrShowWelcomeMessage", 1, Terrasoft.DataValueType.BOOLEAN);

                    update.execute(function() {

                        // do any needed refreshing here etc

                    }, this);

                }

                

            },

            diff: []

        };

    });

 

Show all comments