show interceptor based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 11:31 PM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 02:47 AM
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');
}