Edit button for case form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 10:27 AM
I have created a Ui action to add a button to the CSM workspace case form.
The design is all fields will be read only when a case is opened (On display) and when I click the button "Edit" all fields then become editable excluding the "number" and "priority" fields.
This is the script so far-
Any further assistance to this setup would be appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 06:27 AM
Hello @adam_cannon_23 ,
Your script to make fields editable while keeping certain fields as read-only looks correct. However, there are a few things to consider when adding this UI action to the CSM workspace.
1. Your script should be enclosed in a function and should be specified in the "Script" field of your UI action. Also, ensure that the "Client" checkbox is checked since you're executing client-side scripting.
2. In your 'Onclick' field, specify the name of your function so it gets executed when the button is clicked.
3. Define conditions
Example setup for your UI Action could look like:
- Name: Edit Case
- Table: Case
- Form Button: Selected
- Client: Selected
- Onclick: editCase
- Condition:
!current.newRecord
// This ensures 'Edit' button is not available while creating new records
And in the Script section:
function editCase() {
var fields = g_form.getReadOnlyFields();
var len = fields.length;
for (var i = 0; i < len; i++) {
g_form.setReadOnly(fields[i], false);
}
g_form.setReadOnly("number",true);
g_form.setReadOnly("priority",true);
}
Your onclick field is empty.
Thanks
Amarjeet Pal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 07:16 AM
Hi Amarjeet,
Thank you for your reply, it doesn't look like the button is working, nothing seems to trigger when it is pressed and when trying to use UI Action debug there doesn't look to be any useful information retrievable.
Adam C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 07:38 AM
Hi Amarjeet,
We are unable to get this working, we have tried the above however the button does not look to trigger on click,
When testing none of the read-only fields change and the UI action debug doesn't help much
Kind Regards
Adam Cannon