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

Boyan1
Kilo Sage

Hello,

I have run the view rule and the script is fine.

Can you please check 

- whether view name is correct

- whether there are any other view rules?

 

Best regards,

Boyan

samuelscott
Tera Expert

Sure...thank you for your response...I'll attach images

 

View name: find_real_file.png

 

Other view rules: find_real_file.png

Shillu
Kilo Guru

The view rule is assigning the "cxp_sla" to answer. On the screenshot, it appears as if it's just "cxp sla"(without underscore). Change the assignment to "cxp sla"?

I replicated an example and it does the exact same thing, the name of the view is TLF SLA and the view rule assignment is set to tlf_sla. I tried your recommendartion thoug, it didn't work...is there a table that stores de view names?

 

Thanks!