Thanks for the reply Robert
I want to clarify what you said; your saying the only two work flows that are supported by web app builder are:
1. add services within a web map, that is referenced by the web app builder application or
2. add services into interactions with the widgets themselves.
There is not a way to add services (a layer) within the web app builder JavaScript code, that same way you would add a layer programmatically like:
require([
"esri/Map",
"esri/views/SceneView",
"esri/layers/TileLayer",
"dojo/domReady!"
],
function(
Map, SceneView, TileLayer
) {
var transportationLyr = new TileLayer({
url: "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer"
});
var housingLyr = new TileLayer({
url: "https://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/New_York_Housing_Density/MapSer..."
});
});
Get started with layers | ArcGIS API for JavaScript 4.0