The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Source request button only visible for admin/procurement_user roles

LyndseySharpe
Tera Contributor

Hi,

I am trying to make the 'source request' button on a catalogue task visible for anyone with a role I have just created, called u_tialis_asset. The condition that specifies whether the ui action 'source request' is visible on the catalogue task is this:

new DT_ProcurementUtils().refQualForSourceRequestForIE(current);

 

The script include that it is pulling the condition from is this:

 

//Ref qual for 'Source request' button for IE
    refQualForSourceRequestForIE: function(current) {
        var refQual = current.parent.sys_class_name == "sc_request"
        && current.parent.sourceable
        && !current.parent.sourced
        && !current.isNewRecord()
        && (gs.getSession().getProperty('user_agent_browser') == 'ie'&& gs.getSession().getProperty('user_agent_version') < 10)
        && current.canRead();
        return refQual;
    },
 
I have tried everything to get this button visible to the tialis role! When I change the condition to the below: gs.hasRole('u_tialis_asset') || new DT_ProcurementUtils().refQualForSourceRequestForIE(current);
The button is visible (I know it's visible for all tasks, not only those that are sourceable/not sourced, but I was just testing theory here), but the interceptor that opens when I press source request doesn't look right. It is missing local transfer and vendor purchase. So from this, I've worked out I must edit the script include to make this button visible, as changing the condition on the UI action breaks the functionality for some reason (this is another issue but I'm not getting bogged down in this). I have tried commenting out the code line by line, and I have pinpointed the exact line of code that is making the button invisible to anyone without the procurement_user role:

&& (gs.getSession().getProperty('user_agent_browser') == 'ie'&& gs.getSession().getProperty('user_agent_version') < 10)
When I comment this line of code out, the button is visible to everyone, regardless of having the procurement_user role (although the interceptor is still showing incorrectly, without the local transfer/vendor purchase). When I leave this line in, only those with procurement_user can see the 'source request' ui action/button. So what I need to do (to ensure the interceptor still displays correctly), is to somehow set the browser session to the properties above, for anyone logged in with the u_tialis_asset role. Is this doable? And does anyone know why this strange behaviour is occurring, where this line of code is only working for the procurement_user role? 
 
Thanks! 
Lyndsey
2 REPLIES 2

Ramesh_Naidu
Mega Guru

Hi @LyndseySharpe,

 

Can you check the Read ACL's written on the table and the access that it provides. This can be the reason, as they have used canRead function.

Hi,

Thanks for this, I've already checked the access controls though and they are fine. As stated above, the line of code causing the issue is this:

&& (gs.getSession().getProperty('user_agent_browser') == 'ie'&& gs.getSession().getProperty('user_agent_version') < 10)

I have already commented out the canread() line of code and that doesn't change the conditions of the button.

 

Thanks,

Lyndsey