We have a database table containing field names and what their corresponding field title should be in a DynamicForm. I noticed that there is not a setTitle() on FormItems so I am attempting to override getTitle() to achieve my goals. I am successfully able to override getTitle() to dynamically assign the title as the form is built, however I am having trouble incorporating the logic to assign the title from the database.
I am setting up the form as follows:
The getCustomFieldLabel() function fetches the record based on the field name passed in:
The fieldLabel is assigned correctly in the fetchData() callback function, but I am having a hard time figuring out how I can return that value from the getCustomFieldLabel() function. Since fetchData() is run asynchronously, I am unable to simple return fieldLabel after it executes as the image shows. Is there a way I can access the data returned from fetchData() outside of the callback function? Is there a better way I can accomplish dynamic titles for FormItems?
Thanks!
Version: v12.1p_2021-06-05/Pro
I am setting up the form as follows:
The getCustomFieldLabel() function fetches the record based on the field name passed in:
The fieldLabel is assigned correctly in the fetchData() callback function, but I am having a hard time figuring out how I can return that value from the getCustomFieldLabel() function. Since fetchData() is run asynchronously, I am unable to simple return fieldLabel after it executes as the image shows. Is there a way I can access the data returned from fetchData() outside of the callback function? Is there a better way I can accomplish dynamic titles for FormItems?
Thanks!
Version: v12.1p_2021-06-05/Pro
Comment