[Mobile Agent] Parameter Screen with Reference Input with Autofill Variable of Type User

Community Alums
Not applicable

Hi,

In Agent Mobile application I have created an action to create new Incident using Parameter Screen configuration with inputs.

I have an input Caller type Reference. I want to autopopulate field with currently logged user.

find_real_file.png

find_real_file.png

I use input Autofill variable with type User, but it fills the field with sys id instead of display name.

Variable Type user according to documentation do not have any attributes to define.

find_real_file.png

find_real_file.png

To achieve my goal I have also tried to use Variable type Scripted, with attribute Script and Value reference to Script Include where I return display name of logged user, but it seems like Script Include is not accessed. With this config there is no autofill at all.

find_real_file.pngfind_real_file.png

PS. I had also tried simple return of gs.getUserDisplayName().

 

Could you help please?

7 REPLIES 7

Then this display flag is not set properly in User table

  1. Goto System Definition > Tables
  2. Open sys_user table
  3. Check whether any Column has "Display" field set to true. If not then set "Display" field as true for Column with "Name" as Column Label
Thank you,
Palani

Rohit Kumar11
Tera Contributor

It is better to have just passed the default value in that Item parameter which is created by you in the related list under the Action item.

Item parameters -> Writeback

 

 

BalaK5
Tera Contributor

Hello @Community Alums 

 

Not sure if you have already got a solution for this. But there is one from Service Now as something as below by creating a new Script include following the article. https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1166399

 

var getUserDetails = Class.create();
getUserDetails.prototype = {
initialize: function() {},

getUserObj : function ()
   {
      var userId = gs.getUserID();
    var userName = gs.getUserDisplayName();
    return {
              "Value" : userId,
              "DisplayValue" : userName
        };
   },

type: 'getUserDetails'
};

 

Please mark this answer as correct as it could help others as well.

 

Thank you,

Bala