I have an Portal web map:

enter image description here


The map has a work order layer that is integrated from a Workorder Management System (WMS). Each work order record in the layer has a work order username value (example: JDOE).

I would like to configure the map so that it:

  1. Grabs the SSO username that it used to authenticate the web map
  2. Filters the work orders based on the username

Is it possible do this--to filter the layer based on the SSO username?


You will need to build an attribute expression in the Filter widget:

enter image description here


The custom code below will replace *USERNAME* with the currently logged in user's username.

You will need to alter two of the functions in Filter/Widget.js.

These lines in PostCreate() will get the current Portal username:

this.portal = portalUtils.getPortal(this.appConfig.portalUrl);
this.username = this.portal.user.username;

This 'if' statement in _getExpr() will replace *USERNAME* in the filter expression with the username.

if(expr.indexOf('*USERNAME*') !== -1)
  expr = expr.replace('*USERNAME*',this.username);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.