Showing the ESRI login user name as author for print widget

04-01-2021 12:38 PM
New Contributor III

I made an ArcGIS Web app where users need to enter the username and password of their Esri account when they open the app to be able to use it. Now, is there a way to automate that the Author name of Print widget automatically shows their user ID when they print a map?

0 Kudos
2 Replies
by Anonymous User
Not applicable

Did you build it with the Javascript API? 

If so you can use ["esri/portal/Portal"]

and use the .user property . Something like below should help you find how to use that property ? 



/ load the Portal and PortalQueryParams modules
], function(Portal, PortalQueryParams) {
  portal = new Portal();
  // Setting authMode to immediate signs the user in once loaded
  portal.authMode = "immediate";

  // Once portal is loaded, user signed in
  portal.load().then(function() {

    // Create query parameters for the portal search
    // This object autocasts as new PortalQueryParams()
    var queryParams = {
      query: "owner:" + portal.user.username,
      sortField: "numViews",
      sortOrder: "desc",
      num: 20
    // Query the items based on the queryParams created from portal above



0 Kudos
New Contributor III

I made it with the Web app builder. And also the login credential is actually has been used because my map is not shared with a certain group of usernames.

0 Kudos