If RITM is assigned to the current user

DreDay3000
Giga Guru

Hello, looking for help to fix this script to include if the ritm is assigned to the current user, enable attachments:

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (g_form.getValue('approval') !== 'approved' && g_form.getDisplayBox('cat_item').value == 'Purchase Request') {
        g_form.disableAttachments();
    } else if () {
       
    }
}
 
DreDay3000_0-1718896008837.png

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (g_form.getValue('approval') !== 'approved' && g_form.getDisplayBox('cat_item').value == 'Purchase Request' && g_form.getValue('assigned_to') != g_user.userID) {
        g_form.disableAttachments();
    }
}

 

Instead of going if - else -if , i have appended it in the same condition in IF that the current logged in user is not the assigned to + the other conditions, only the the attachments will be disabled.

 

-Anurag

View solution in original post

1 REPLY 1

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (g_form.getValue('approval') !== 'approved' && g_form.getDisplayBox('cat_item').value == 'Purchase Request' && g_form.getValue('assigned_to') != g_user.userID) {
        g_form.disableAttachments();
    }
}

 

Instead of going if - else -if , i have appended it in the same condition in IF that the current logged in user is not the assigned to + the other conditions, only the the attachments will be disabled.

 

-Anurag