Hey Everyone,
I think I have figured out a workaround for this issue! Hopefully this method can help you out too.
My Method:
1a) Created a view in SDE for my related table, where the SQL expression specifies only the most recent related record should be returned if there are matching global ID's in the related table (ie. if there are more than one related records for a single feature). My expression input into "Create Database View" tool:
SELECT OBJECTID, GlobalID_rel, PaintType, created_date, DatePainted
FROM database.user.CrosswalksAndStopBars_RelatedTable AS t
WHERE created_date =
(SELECT MAX(created_date)
FROM database.user.CrosswalksAndStopBars_RelatedTable
WHERE GlobalID_rel = t.GlobalID_rel)
1b) The "SELECT MAX" portion of the code is what returns only the newest related record in the view.
2a) I then used SQL Server Management Studio to help me build another view expression to join the SDE feature class with the newly created related table view. I copied the expression generated from SQL server into the "Create Database View" tool:
SELECT USER.CROSSWALKSANDSTOPBARS.GlobalID, USER.CROSSWALKSANDSTOPBARS.OBJECTID, USER.CROSSWALKSANDSTOPBARS.CrosswalkType, USER.CROSSWALKSANDSTOPBARS.Notes,
USER.CROSSWALKSANDSTOPBARS.SHAPE, USER.CROSSWALKSANDSTOPBARS.GDB_GEOMATTR_DATA, USER.CrosswalksAndStopBars_RelatedTable_View.OBJECTID AS ObjectID_Rel,
USER.CrosswalksAndStopBars_RelatedTable_View.GlobalID_rel, USER.CrosswalksAndStopBars_RelatedTable_View.PaintType, USER.CrosswalksAndStopBars_RelatedTable_View.created_date,
USER.CrosswalksAndStopBars_RelatedTable_View.DatePainted
FROM USER.CROSSWALKSANDSTOPBARS LEFT OUTER JOIN
USER.CrosswalksAndStopBars_RelatedTable_View ON USER.CROSSWALKSANDSTOPBARS.GlobalID = USER.CrosswalksAndStopBars_RelatedTable_View.GlobalID_rel
2b) The output view joins the feature with the newest related record for that feature, using the global ID in the feature class and the related global ID field in the related table view.
3) I created a map service with Mapping capability that shares the view created in step 2. I was then able to input the REST endpoint of this service into my AGOL web maps for my applications, displaying only the newest related record for each feature.
Note: A LEFT OUTER JOIN was used in step 2a so that my view I was sharing with AGOL would show both features that had no related records yet created and features that had 1 or more related records (displaying only the newest related record of course).
Hope this helps!
Brett