Restrict Actions on the Allocation Workbench (Confirm - Allocate)

Lylys
Giga Contributor

Hello,

I have a question about the restriction on the Actions in the Allocation Workbench.

I customize the UI Action Confirm and Allocate 

I change the condition.

How I put the same condition on the allocation Workbench?

 

 

 

 

Thanks a lot.

 

 

1 ACCEPTED SOLUTION

Harsha Lanka
ServiceNow Employee
ServiceNow Employee

In your code, current is 'not defined'.

Try in below way.

var RMActionValidator = Class.create();
RMActionValidator.prototype = Object.extendsObject( RMActionValidatorSNC,{
    initialize: function(gr) {
                this.currentResPlanGr = gr;
		RMActionValidatorSNC.prototype.initialize.call(this, gr);
    },

    canConfirm: function() {
       if((gs.getUserID()==this.currentResPlanGr.user_resource.manager)||(gs.getUserID()==this.currentResPlanGr.group_resource.manager)){
			return true; // You can add your logic here and return a boolean value
		}else{
			return false;
		}
    }

    type: 'RMActionValidator'
});

View solution in original post

7 REPLIES 7

Noah Drew
ServiceNow Employee
ServiceNow Employee

Hi @Lylys !

You may be looking for the "ResourceGridActionHandler" Script Include.

This appears to be where the button functionality is defined. I do not believe that you can actually modify the buttons to become invisible as much of the Allocation Workbench is designed in the inaccessible Java Layer. Perhaps you could add validation here to prevent the action from being taken and maybe display a message saying that the user does not have the privileges to perform the action.

Hope that helps!

If it did, please mark as Helpful and consider setting the reply as the Correct Answer to the question, thanks!

Lylys
Giga Contributor

Hello 

Thanks for your response.

But I don't see how I can pu my script on this script include.

For It is not easy.

 

Lylys

Harsha Lanka
ServiceNow Employee
ServiceNow Employee

Hi,

  • Yes, there is a way to configure/customize 'Allocation Workbench' grid actions.
  • You need to override the method 'canConfirm' and 'canAllocate' methods in 'RMActionValidatorSNC' Script include(This is a read only script include and you should not modify any code here).
  • To override those methods, you need to re-define/override 'canConfirm' and 'canAllocate' methods in 'RMActionValidator' script include (This is the place where we expect customers to configure/override the functionality). By default, this is empty and this extends 'RMActionValidatorSNC' script include.

    Please find the below example to override canConfirm
    var RMActionValidator = Class.create();
    RMActionValidator.prototype = Object.extendsObject( RMActionValidatorSNC,{
        initialize: function(gr) {
    		RMActionValidatorSNC.prototype.initialize.call(this, gr);
        },
    
        canConfirm: function() {
           return false; // You can add your logic here and return a boolean value
        }
    
        type: 'RMActionValidator'
    });​

 

Thanks,
Harsha Lanka

 

Hi @Harsha Lanka ,

 

Thanks for your response.

I put this code but when I open the Allocation Workbench, he load again and again. 

And the list user of Resource plan doesn't appear.

 

canConfirm: function() {
		if((gs.getUserID()==current.user_resource.manager)||(gs.getUserID()==current.group_resource.manager)){
			return true; // You can add your logic here and return a boolean value
		}else{
			return false;
		}
       

 

I think create an ACL. It's possible or not?

 

Thanks 

Lylys