We are using a Closest Facility service, but we require that the incidents do not search certain network sources when calculating network locations - i.e. the route should not connect directly to rail, but must travel first by road then via a station to access rail.
In the ArcMap days this was a setting that could be defined on the network (What are network analysis objects?—ArcMap | Documentation (arcgis.com) ref: Snapping environment for network locations), which would be honoured in the service. However, with ArcGIS Pro this can only be specified in the "Add Locations" tool (Add Locations (Network Analyst)—ArcGIS Pro | Documentation), i.e. it is not part of the service, and there does not appear to be a way to specify the corresponding Search Criteria through the JavaScript API.
Am I just missing something, or is this going to eventually end up in DataLayer | ArcGIS API for JavaScript 4.21 | ArcGIS Developer, but it's just not there yet...?