Does the default JavaScript API (v4) popup support related records?

3232
16
10-15-2017 05:42 AM
GFlonk
by
New Contributor III

I'm not sure if i'm overlooking things or this is not yet supported, but i'm curious if the default JavaScript API (v4) popup supports related records.

I have the following situation:

  • Hosted feature service on ArcGIS Online. In it three sublayers (trees, roads and vegetation). Each of the sublayers has a related table in which i store quality-inspection records (quality level, date of inspection and attachment-option). The relation is 1-m.
  • Hosted feature service is added to a webmap which is also stored on AGO.
  • In my custom front-end i created a mapView which loads the entire webmap at once (rather than adding all layer individually)
  • Map draws perfectly and the popup works, but does not show the related records. Related records are however visible and editable in collector, explorer and via webappbuilder (see screenshot).

Example in default JSAPI popup:

Example of record in default JSapi popup (v4)

Example in Webappbuilder:

Example of record in webappbuilder

What i'm looking for is the option to add the functionality regarding the related records in the second screenshot to the situation in the first screenshot.

My question is twofold:

  • Is this supported by default and if yes, how do i turn it on?
  • If this is not a default option, how would one go about and custom create this functionality?
16 Replies
GFlonk
by
New Contributor III

Robert, 

That worked like a charm! Thank you. I expanded a little bit on it and am now getting the related records as a response after selectedFeature changes:

The code I used (might not be pretty, but it works):

watchUtils.when(view.popup, "selectedFeature", function(evt){
     console.log(view.popup.selectedFeature);
     
     var url = view.popup.selectedFeature.layer.url;
     var layerId = view.popup.selectedFeature.layer.layerId;
     var fullURL = url + "/" + layerId;
     var objectID = view.popup.selectedFeature.attributes.OBJECTID;

     var queryTask = new QueryTask({
          url: fullURL
     });
     
     relationQuery = new RelationshipQuery({
          objectIds: [objectID],
          outFields: ["*"],
          relationshipId: 0
     });
     
     queryTask.executeRelationshipQuery(relationQuery).then(function(results){
          console.log(results)
     });
});

Now what I've got to do is append this to the content property of the popup.

I'll keep this thread updated.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I like to use dojo dom-construct for building html elements and then domConstruct.place to add them. You can use dojo query to get the infoWindow dim node to append to.

0 Kudos
AnninaHirschiWyss
Occasional Contributor II

Is there a road map / timeline when editing related records will be possible with the JS API v4?

Thx

Jim Barry‌ or anyone else from the dev-team?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Annina,

  Just FYI Jim is not on the development team.

AnninaHirschiWyss
Occasional Contributor II

Thanks, Robert, I just took his name because he figures as responsible for this space. Maybe he can transfer the question to someone in charge 🙂

0 Kudos
JimBarry
Esri Regular Contributor

Sorry for the delay on this. Checking with the dev team to see what they say.

0 Kudos
JimBarry
Esri Regular Contributor

It's on our plan for 2020. Might not be the next release, but something being worked on.