Multiple Portal Usage

342
1
08-24-2018 02:58 AM
JustinCarasick
New Contributor III

is there a way to load a portal item from 2 different portals to a map?

for example (pseudo code),

   esriConfig.portalUrl = "https://myHostName.esri.com/arcgis"

   //create portal item

   map.add(portalitemlayer)

   esriConfig.portalUrl = "https://myHostName2.esri.com/arcgis"

  //create portal item

  map.add(portalitemlayer2)

will i be able to use both layers on the map or will the first item be severed because the portalUrl has changed.

Or can i do

portal = new Portal({ url: "https://myHostName.esri.com/arcgis" })

portal2 = new Portal({ url: "https://myHostName2.esri.com/arcgis" })

and somehow do something like

map.add(portal.portalitemlayer)

map.add(portal2.portalitemlayer2)

0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor II

You could try Layer.fromPortalItem()

Layer | API Reference | ArcGIS API for JavaScript 4.8 

It takes a PortalItem object, which contains a portal instance.

PortalItem | API Reference | ArcGIS API for JavaScript 4.8 

You might be able to define the Portal url for the item in there.

Portal | API Reference | ArcGIS API for JavaScript 4.8 

I've never tried that workflow, but I think it might work.

Would love to hear if it did!

0 Kudos