Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Relabel field in form based on condition

Arun_Manoj
Mega Sage

Hi,

One field needs to relabel on form based on the condition.

where issue type= risk event

the issue owner field label needs to relabel to Risk event manager.

 

please suggest a solution

1 ACCEPTED SOLUTION

@Arun_Manoj 

Already informed -> its not possible in workspace

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

9 REPLIES 9

trinadh4
Tera Contributor

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === oldValue) {
        return;
    }

 

    // Adjust the constant to match the value used in your choice list
    var RISK_EVENT_VALUE = 'risk_event';

 

    if (newValue === RISK_EVENT_VALUE) {
        g_form.setLabelOf('issue_owner', 'Risk event manager');
    } else {
        // fallback label when not risk event
        g_form.setLabelOf('issue_owner', 'Issue owner');
    }
}

as per my requirement,

when the state change to analyse and the form get save then this field visible . I need this relabel in workspace

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Arun_Manoj 

it's not possible to change column label using script in Configurable Workspaces

g_form.setLabelOf() will work in native but not in workspace

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar ,

is there any possible way in workspace?

@Arun_Manoj 

Already informed -> its not possible in workspace

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader