show interceptor based on condition

Dedeepya Reddy
Tera Expert

A problem has a related list "P task", when we click on new, it navigates to a interceptor which two answers(rca task and normal task). My requirement is ,when the problem state is in "Fix in progress", I only want the interceptor to show one link(i.e., normal task but not rca ).
So based on the state of problem , I want the interceptor to show only one answer. 
Is there a way to achieve this or any alternative way ?


1 REPLY 1

Hayo Lubbers
Kilo Sage

Hi @Dedeepya Reddy ,

 

I don't think you can show different options based on conditions in the interceptor.

You can copy the UI Action to your own version.

 

Change the Action name to a custom action name (something like 'sysverb_problem_task_new', make sure it starts with sysverb_ to prevent the 'no record selected' message).

Set the condition to : current.getTableName()=='problem_task' && current.canCreate() && RP.isRelatedList() && !RP.isManyToMany() && !RP.isInDevStudio()

Omit the New button in the list control

 

Change the code to verify the status of the parent record. Instead of if(path), you can change it to something like:

if (path && parent.state != 104){
   action.setRedirectURL(uri.toString(path));
}else{
	action.setRedirectURL('problem_task.do?sys_id=-1&sysparm_query=problem_task_type=general');
}