Make Close Code mandatory when trying to cancel change task by clicking UI button.

Shidhi
Tera Contributor

Hi,

 

I'm trying to make close_notes mandatory(by default this field will be read only) when canceling a change task using a UI button which i have created as below:

 

Action Name: cancelRecord
Client checkbox: True
onClick: cancelTask();

 

function cancelTask() {
    if (g_form.getValue('close_notes' == '')) {
        g_form.setMandatory('close_notes', true);
        g_form.showFieldMsg('close_notes', 'Enter Close Notes', 'error');
        return false;
    } else {
        alert('Cancelling the task');
        gsftSubmit(null, g_form.getFormElement(), 'cancelRecord');
	
	}
}
        if (typeof window == 'undefined') {
            cancelTaskRecord();
        }
        function cancelTaskRecord() {
        current.state = '4';
        current.update();
        action.setRedirectURL(current);
        }
	
    

 

 

But I can't make close notes mandatory. The control always goes into the else block, and I'm able to cancel it, but I'm not getting an error to fill in the close notes.

 

Please help me.

 

Thank you!

 

1 ACCEPTED SOLUTION

@Shidhi Ideally creating an additional ACL on the change request/task table should work. User should be able to get access on your new ACLs on the close_notes field.

View solution in original post

14 REPLIES 14

@Shidhi Please share the screenshot of ACL

Hi @Sandeep Rajput 

 

There is an ACL on the Task table as shown below.

Shidhi_0-1725389615111.png

 



It is working as expected if I deactivate it. But this is written on the Task table so it will impact everything. I tried adding the OR condition (change initiator is dynamic me) and also created new ACL both on task and change_request tables but it is not working.

Please help/any suggestions.




 

@Shidhi Ideally creating an additional ACL on the change request/task table should work. User should be able to get access on your new ACLs on the close_notes field.

Create a Support Case, your UI Action, with the changes recommended by Sandeep and myself works OOB.

Siddiqbasha
Tera Contributor

solution for close notes mandatory.JPG