I'm learning to use python Notebooks on ArcGIS Online, trying to automate some manual web map updates that I do.
In python, I add a layer to a web map and access the popupInfo JSON in order to change field labels, set decimal places, the digit separator, and remove some fields from the popup view. I see in the layer's JSON that the popupInfo object has its own fieldInfos, but it also has a popupElements object, which, if type is "field", it also has a fieldInfos property.
In which place should I be updating the field properties for the popup window display?
Also, if a newly added layer does not have in its JSON a popupElements property with its own fieldInfos, should I create it, and how?