PRD-4723: Additional fix for datasource editor query scripting

This uses the model instead of querying items from the UI components. This solves an out-of-order update that overwrites good data.