How can I display other user attributes when doing @mention so users with same name can be differentiated

traceymcknight
Tera Contributor

When using @mention for John Smith I get 4 options and can't see any other user properties to know which one is correct one to select.  How can we add attribute like job title or userid to this display?

12 REPLIES 12

Clarkie1
Giga Expert

Hi,

You can do a workaround by updating the sys_user name dictionary item. The calculated item can do the same checks for @mention and display a different calculated value there.

Example workaround:

 

 

// At the end of the calculated value script, add the below

if (gs.getSession().isInteractive()) { // only do for interactive sessions
  if (gs.action.getGlideURI() != "") {
    if (gs.action.getGlideURI().getMap() != '') {
      if (gs.action.getGlideURI().toString().startsWith('api/now/form/mention/record/')) { // @ mention is being used
        current.user_name; // return user_id field - change this combo to be anything you would like
      }
    }
  }
}

This seems to do the trick. I think having the job title as an additional identifier may be the best option, as email addresses or employee ids are open to interpretation.

Community Alums
Not applicable

Hi Clarkie1,

 

So I tried this in my PDI but there is unexpected behavior. so for example on the sc_req_item table. if a user with the same first and last name 

e.g.  User 1 Name is Requested For so User 2 Name appears, but User 1 Name appears as User Name instead of User 1 Name. 

If User 1 is the Requested for then User 2 Name will show up in the mention with 2 as the middle name, but User 1 appears as User Name instead of User 1 Name. Hope that makes sense.

Is there a way to force all the info into the message label regardless of requested for/requested by fields?

Apologies for replying to such an old thread, but this is really the only place where this topic is discussed.

 

While this does exactly what I want it to do, it's also changing the display in the Banner Frame, but only after I perform a mention.

 

By that I mean, I can update the calculated value on the sys_user display field and jump around the platform all I want, and my name in the banner is fine. The moment I perform any mention, regardless of whether or not I'm included in the query/results, my name now changes in the banner and stays that way until I log out. Once I log out and back in, the name shows as expected, until I perform another mention. 

 

Kind of odd and I'm at my wits end in trying to figure this one out. 

Community Alums
Not applicable

I'm curious what version are you on in your platform. I'm not seeing your behavior in Utah (with Next Experience on) And on which banner. in Service Portal, or UI16/Next Experience?