Webmaps store details with URL addresses for feature layers that are used when it is developed. It does not read the feature layer's details at startup. This makes it difficult for a user to do basic development and later update the webmap for production.
We have updated the schema in a test database that has attributes to be used in a new webmap. These attributes do not yet exist in production. A feature layer is created that points to the test database, and then a webmap is created using that feature layer. The webmap is built to include symbology and popups are configured. Users are prompted for a login ID and password when the webmap starts to make sure they are allowed to access the data provided via the feature layer. As part of the login screen the feature layer to be accessed is also displayed.
Fast forward and the new attribute is added to the production schema. I created a new feature service to point to the production data which now has the same schema as production. Since we have a webmap built and configured as desired, I should be able to make a minor modification to the feature layer in AGOL and change the data source. I can do this by going to the feature layer in AGOL and then going to the Settings tab. After changing the URL for the data source, I can go to the data tab and verify the change was saved.
I now have a webmap with symbology and popups configured. The only change I've made is to the feature layer to have the URL for the data source point to the feature layer that uses the production database. However, when I start the webmap it prompts me for a login that is still pointing to the test database. Working with Esri technical support, we are able to determine the URL(s) for the feature service that points to the test feature service is stored in the JSON for the webmap. The only way for me to fix this is to edit the JSON for the webmap and have it point to the URL for the production feature service layer.
My suggestion is that the webmap should not be reading URL information from the data source upon startup, but it should be reading from the feature layer. This way the changes will be detected.