The CreatorCon Call for Content is officially open! Get started here.

Change - Restrict ability to remove attachments after approval.

snighu2495
Kilo Contributor

Hi all,

Can we restrict ability to remove attachment after changes are approved for Normal and Emergency Change Requests at Scheduled/Implement/Review/Closed States.

Please can any one suggest me other than acl.

Thanks,

Sindhu

6 REPLIES 6

Lucky8
Tera Contributor

Hi,

//Hide attachment Icon when state is scheduled/Implement/review but not for user has role admins and Change Manager

 

I tried onload client script its working as expected

 

function onLoad() {

 

    var state = g_form.getValue('state');

    var loggeduser = g_user.userID;

 

    if ((state == '-2' || state == '-1' || state == '0') && (!g_user.hasRole('admin')) && (!g_user.hasRole('change_manager'))) {  

 

        g_form.disableAttachments();

 

    } else {

 

        g_form.enableAttachments();

 

    }

 

Lucky8
Tera Contributor

Ignore the above one

tried another OnLoad client script

See below 

function onLoad() {

   //Type appropriate comment here, and begin script below

   var state = g_form.getValue('state');

 

   if(state == '-2' || state == '-1' || state == '0'|| state == '3') //scheduled/Implement/review/Closed

    //please change this if condition to

  //if you want the attachment icon to be available in either admin or change_manager

    if(g_user.hasRole('admin') || g_user.hasRole('change_manager'))

    // the below code requires the user to be both admin and change_manager

    //if(g_user.hasRole('admin') && g_user.hasRole('change_manager'))

        g_form.enableAttachments();

    else

        g_form.disableAttachments();

        

}

 

Thanks,

Lakshmi...