Make A Record Inactive From UI Action Workspace Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 05:27 AM
I have a client UI action, which is available for workspace as well (This Ui action changes the Policy state to Draft which is currently in review). The requirement is to make comments mandatory as soon as we click on button 'back to draft'. here the code I have written in the workspace client script.
function onClick(g_form) {
g_form.setValue('active', false);
g_form.setValue('state', 'draft');
g_form.setMandatory('comments', true);
g_form.save();
}
But here everything is working as expected expect this is not setting the record to inactive. Anyone has any clue on this and how can I achieve this.
P.S. OOB this UI action is having server side script written, which is setting the state to draft and current.active to false. Since I have to come to my requirement to I deactivated to test create a new one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 05:38 AM - edited ‎04-22-2024 05:45 AM
Hi @Kapil_1409 ,
Since you are making the record inactive from client side, the "active" field should be present on the form. If not, just add the field on the form layout and your code should work.
Note : If you don't want active field to be visible on the form, add the "active" to form layout and hide it with the UI policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2024 01:03 AM
Hi Anirudh,
This doesn't work, I tried this, but it still doesn't make form inactive. although moving it to draft and making comments mandatory are working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 07:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2024 01:06 AM
Hi Siddharam,
your solution is working fine also creates and issue. there is button post comments available. if user clicks that first and then click on UI action it dosent work although if he just write comments and not click Post comments button although simply click bac k to draft. It works, is there any solution for this.