Please help with hide a UI Action scripting.

Annie10
Tera Contributor

Hello,

I created a copy incident button and would like it to hide after it's clicked on. is that possible?  Thank you

Annie10_0-1713458885617.png

 

3 REPLIES 3

ursnani
Giga Guru

Firstly we need to know whether we copied the record or not for that either you can relationship between copied and Original record and based on that you can hide the UI action.

 

The other way is having a Checkbox on the record and once the Record is copied we can mark that checkbox as true and based on this checkbox(if Checkbox is false) you can show and if its true you can hide the UI Action.

 

Please Mark my answer as correct if it helps.

 

Thanks.

ajay98
Tera Contributor

Yes @Annie10  its possible !!!
just follow some steps...
step 1 : Open any incident record
step 2: right click
configure>UI action
Step 3 : Choose you button name
Step 5 : Write your logic inside the script section

Annie10
Tera Contributor

Hi @ajay98 

I am still learning JavaScript and I need some guidance from you or the community on how I would code this.

This is a custom button.  I would like the button to hide once the user clicked on close button on the popup message.  Thank you

 

 

Annie10_1-1713469451257.png

 

function hideButton() {
    
    var dd = new GlideModal('Confirm');
    dd.setTitle('Comfirmation');
    dd.renderWithContent('<div>The duplication of this incident has been sucessfully completed. <div style="text-align: right;"><button onclick="cancel()">Close</button></div>');

    function confirm() {
        gsftSubmit(null, g_form.getFormElement(), 'continue_scoping');
    }

    function cancel() {
        dd.desctroy();

    }
}