Learn about step to get login user and put to field name "Requester" on screen.

Procedure

  1. From ONEWEB workspace, create java file name "com.manual.doc.order.java.OrderRequestRequesterInsertMode" in MasterWeb with coding below.


package com.manual.doc.order.java;


import java.util.HashMap;


import org.apache.log4j.Logger;


import com.master.form.EntityFormHandler;

import com.master.util.EAFManualUtil;

import com.master.util.ProcessAction;

import com.master.util.ProcessHelper;


public class OrderRequestRequesterInsertMode extends ProcessHelper implements ProcessAction {

       Logger logger = Logger.getLogger(OrderRequestRequesterInsertMode.class);

       @Override

       public void modifyInsert() {

               logger.debug("========= Get userName from userLogin and put to Requester on screen =======");

               //get data model of main module

               String entityID = (String)getRequest().getSession().getAttribute("entityID");

               EntityFormHandler entityForm = (EntityFormHandler)getRequest().getSession().getAttribute(entityID +"_session");

               String moduleID = entityForm.getMainModuleID();

               

               String userName = (String)request.getSession().getAttribute("userName");

               HashMap hRequester = EAFManualUtil.getDataHashMapFromSession(moduleID, request);

               //set value of field "Requester" as user login

               hRequester.put("REQUESTER", userName);                

       }

}


  1. From ONEWEB workspace, export EafMasterEar.ear and deploy update to server. The new class name "com.manual.doc.order.java.OrderRequestRequesterInsertMode" will deploy to server.


  1. Go to App Designer and open entity name "Doc Order Request - Requester" to edit.


  1. From Tools > Action drag Entity Action to the box under entity name. The action name "SEARCH" shows then click icon pencil to edit it. The dialog of Action Field Configuration opens.
    • Change Process Name to "INSERT"
    • Put "com.manual.doc.order.java.OrderRequestRequesterInsertMode" to Class Action.
    • Click OK.


  1. Click Save this Entity.


  1. Test by log in to FrontWeb.
    • Click menu SETTING > Refresh Cache to update new configuration at App Designer to server.
    • Click menu DOC Order Request and click CREATE. Login user will autometic put to field Requester.