Make Planned Start Date and Planned End Date fields editable for admin.

pawank2
Tera Expert

I want to make the Planned Start Date and Planned End Date fields editable on the Change Request form, but only until the state reaches Schedule, and only for users with the admin role. There is already a client script in place, and I’d like to add these conditions to it.

 

Does anyone know what condition I should use in the script to achieve this?
 
 
1 ACCEPTED SOLUTION

anshul_goyal
Kilo Sage

Hello @pawank2,

In your client script add below logic to make fields editable only for admin and till 'Schedule' state:
var changeState = g_form.getValue('state');
if (g_user.hasRoleExactly('admin') && (state == 'New ' || state == 'Assess' || state == 'Authorize')) {
g_form.setReadOnly('start_date', false);
g_form.setReadOnly('end_date', false);
} else {
g_form.setReadOnly('start_date', true);
g_form.setReadOnly('end_date', true);
}


Please mark my response Accepted and Helpful for future references.

Thanks

View solution in original post

2 REPLIES 2

anshul_goyal
Kilo Sage

Hello @pawank2,

In your client script add below logic to make fields editable only for admin and till 'Schedule' state:
var changeState = g_form.getValue('state');
if (g_user.hasRoleExactly('admin') && (state == 'New ' || state == 'Assess' || state == 'Authorize')) {
g_form.setReadOnly('start_date', false);
g_form.setReadOnly('end_date', false);
} else {
g_form.setReadOnly('start_date', true);
g_form.setReadOnly('end_date', true);
}


Please mark my response Accepted and Helpful for future references.

Thanks

Thanks for reply my post.