Make fields readonly and also editable on clicking UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 02:56 AM
Hi Team,
Need help in following requirement:
Make fields read-only (Assigned To and Assignment group) once filled in Case form and once users click on Transfer button, then Assigned To and Assignment group editable so that users can transfer ticket to other team.
I have written UI policy and UI action and assuming because of UI policy , UI action code not working to make fields editable.
Kindly suggest.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 03:07 AM
I think UI action executes first and UI policy next. so, you can add a condition in UI policy when it has to run and not conflict the Ui action code.
please refer the below link for execution order.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 03:18 AM
Thanks for the reply. But I changed order of execution even It did not work.
1. I have written policy - if Assigned to is not empty-> make fields (Assigned To and Assignment group) read only
2. Written UI action : to make a field mandatory and also (Assigned To and Assignment group) editable:
Mandatory condition is working but not Readonly condition.
function runClientCode(){
if(g_form.getValue('u_reason_for_transfer')==''){
g_form.showFieldMsg('u_reason_for_transfer','Reason for Transfer is Mandatory before transferring','error');
g_form.setMandatory('u_reason_for_transfer','true');
g_form.setReadOnly('assignment_group', 'false');
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'submit_t_form'); //MUST call the 'Action name' set in this UI Action
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 03:22 AM
you can add more condition in UI policy where 'u_reason_for_transfer' is not empty then it should be read only. so i think in this way there will not be any conflict.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 03:43 AM
It is working for one iteration, lets say people filled Reason to Transfer field and saved form , now again it they want to transfer the ticket, then once they click on button, it should clear the field and editable same way to enter new details
Thanks a lot