Better method for triggeredByID accessing UI elements

Is there a better way to do this without the mapping? I don't see a getElementByID function as I know js queries are run in a sandbox. I am moving one of my dialogs from a submit form to a dynamically updated form on blur. I want to setDisabled the element while the query runs. I'd like to not have to maintain this objectMapping list

const objectMapping = {
  "cadURLInput": cadURLInput,
  "indexTextInput": indexTextInput,
  "bomLevelTextInput" : bomLevelTextInput,
  "isRoot" : isRoot,
  "checkboxAssembly" : checkboxAssembly,
  "deliverQuantityTextInput" : deliverQuantityTextInput,
  "innateQuantityTextInput" : innateQuantityTextInput,
  "xTextInput" : xTextInput,
  "yTextInput" : yTextInput,
  "zTextInput" : zTextInput,
  "partNumberText" : partNumberText
  
};

const SELF = objectMapping[triggeredById];
const KEY = objectMapping[triggeredById].formDataKey
const VALUE = objectMapping[triggeredById].value

SELF.setDisabled(true);
const options = {
  additionalScope: { KEY, VALUE },
  onSuccess: function(data) {
    // Code to execute when the query is successful
    SELF.setDisabled(false);
    dataStore.setIn([KEY], VALUE);
    console.log("Query succeeded");
    // For example, trigger another query
  },
  onFailure: function(error) { 
    console.log('Update failed:', error)
    SELF.setDisabled(false);                           
  },
};

UpdateField.trigger(options);

Hi @FBCRandy,

The objectMapping list is the best idea I'm aware of (unless you want to have a hardcoded query for each component) :thinking: totally get that it is tedious to maintain though

We have a feature request in our backlog to find a better way to solve this, but it is tricky without negatively impacting performance