Run Form Script Acitivity for updating a form field's description

I have a UiPath form (new new modern form), and I would like to dynamically update a field’s description. I have tried using the “Run Form Script Activity”, but I don’t know what javascript to provide to update a fields description field. Can anybody help with this?

I have tried something like this, but it dosen’t work:
“form.getComponent(‘fldEmail’).then(function(component) {
component.component.description = ““Please enter your company email””;
component.redraw();
});”

hi, @Tom_Birch_Hansen

Use the form’s internal formJson to modify the component’s description property directly, then trigger a re-render:

formJson.components.forEach(comp => {
  if (comp.key === 'fldEmail') {
    comp.description = 'Please enter your company email';
  }
});
form.root.redraw();

Replace ‘fldEmail’ with your exact Field Key (check in Form Designer).

For dynamic descriptions, prefer Set Form Values activity instead of JS pass a dictionary with your field key and use FormFieldsInputData for metadata updates

Test in a form event trigger first. If it fails, share your exact field key/error

@Tom_Birch_Hansen
var comp = form.getComponent(‘fldEmail’);

if(comp) {
comp.component.description = “Please enter your company email”;
comp.redraw();
}

Hi @Tom_Birch_Hansen

Use this script inside Run Form Script:

var c=form.getComponent(‘FldEmail’);
if(c){
c.component.tooltop=“plz enter your company email”;
c.redraw();
}

Hi @Tom_Birch_Hansen,

In the new modern forms the description property is not exposed for live updates. Changing component.component.description does not work because the form engine does not re-render that metadata at runtime. Only values and visible/disabled states can be updated dynamically. Descriptions and labels are static. The only workaround is to place a separate text field or html element and update that instead, because true description text cannot be changed through Run Form Script.

What condition should trigger it?

For example, this snippet will update it on a button click:

"formio.activeForm._form.components.find(c => c.key === ""fldEmail"").placeholder = ""my new value"";formio.redraw();"

EDIT. I think your snippet might have been quite close as well, it’s just that the form object is called formio and not form.

You can right click the form and inspect everything:

Can you give this a try.

var comp = Formio.getComponent(‘fldEmail’);
if (comp) {
comp.component.description = “Please enter your company email”;
comp.triggerRedraw();
}