View rule is not working...

samuelscott
Tera Expert

I want a user with a certain role to be able to look at the customized task_sla list but it is not working.

 

The user has the role: cx_procurement_manager.

 

This is the script written under the view rule (CXP SLA is the name of the configured task_sla list): 

 

(function overrideView(view, is_list) {

 

answer = null;  // set the new view to answer

// Add your code here

if (is_list){

if (gs.hasRole('cx_procurement_manager')){

answer = 'cxp_sla';  // set the new view to answer

}

}

})(view, is_list);

 

//please helpp

1 ACCEPTED SOLUTION

I recommend moving the answer = null to inside the else statement if possible, something like this:

(function overrideView(view, is_list) {

	// Add your code here

	if (is_list){

		if (gs.hasRole('cx_procurement_manager')){

			answer = 'cxp_sla';  // set the new view to answer

		} else {
			
			answer = null;
		}

	}

})(view, is_list);

Although, you can just not having the else statement as well as answer = null; altogether because answer will be set to the default view anyway, if I am not mistaken.

 

Regards,

Phuong

If you find my suggestions helpful, please mark it as correct or helpful to help out others as well 🙂 

View solution in original post

7 REPLIES 7

the table is sys_ui_view.

samuelscott
Tera Expert

I checked the table and the name of the view I placed on the view rule was correct...I still can't seem to solve this problem

I recommend moving the answer = null to inside the else statement if possible, something like this:

(function overrideView(view, is_list) {

	// Add your code here

	if (is_list){

		if (gs.hasRole('cx_procurement_manager')){

			answer = 'cxp_sla';  // set the new view to answer

		} else {
			
			answer = null;
		}

	}

})(view, is_list);

Although, you can just not having the else statement as well as answer = null; altogether because answer will be set to the default view anyway, if I am not mistaken.

 

Regards,

Phuong

If you find my suggestions helpful, please mark it as correct or helpful to help out others as well 🙂