- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 10:53 PM
RCA Required Attribute in the Incident form:
Requirement:
In the Incident form, there is a custom field labelled "Is RCA required" with two options: (a) Yes,
and (b) No.
- When the Priority field becomes “1-Critical” at any point in its lifecycle of incident , then “Is RCA required” field should automatically be set to “Yes” and become read-only , even if the Priority field changes to “2-High” or “3-Moderate” or “4-Low” even then “Is RCA required” field should be read-only.
- If the Priority is directly set to other than “1-Critical”, then “Is RCA required” field should be editable. While trying to achieve this I’m facing some issues below is the approach I followed. Please review and suggest is there any alternative way to achieve this.
- We have written a client script that checks the old and new values of the Priority field to determine if it has been set to “1-Critical.” If so, it sets the “Is RCA required” field to “Yes” and makes it read-only.
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
if (newValue === '1') {
g_form.setValue('u_is_rca_required', 'yes');
g_form.setReadOnly('u_is_rca_required', true);
}
// Check if oldValue was '1' and newValue is '2', '3', or '4'
else if (oldValue === '1' && ['2', '3', '4'].includes(newValue)) {
g_form.setValue('u_is_rca_required', 'yes');
g_form.setReadOnly('u_is_rca_required', true);
} // If the form is loading, we exit the function early.
}
// Check if the new value is '1' (P1 incident)
if (newValue === '1') {
g_form.setValue('u_is_rca_required', 'yes');
g_form.setReadOnly('u_is_rca_required', true);
}
// Check if oldValue was '1' and newValue is '2', '3', or '4'
else if (oldValue === '1' && ['2', '3', '4'].includes(newValue)) {
g_form.setValue('u_is_rca_required', 'yes');
g_form.setReadOnly('u_is_rca_required', true);
}
}
Please suggest the possible ways to achieve the above requested scenario @Ankur Bawiskar @Pranav Bhagat @Chuck Tomasi @Pradeep Sharma @Earl Duque @Laurel McDevitt
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 09:04 AM
Hello @afreen shaik
After thoroughly analyzing the scenario and testing various approaches, I identified a solution to meet the requirement.
To implement this, follow these steps:
Create a new field (e.g., RCA) on the Incident table. This field can be hidden on the form, and it will store a value (such as "Yes") whenever the Priority is set to Critical (P1).
Set up a UI Policy to monitor the Priority field. When the Priority is "1", this policy will set the RCA field to "Yes".
Create another UI Policy that checks if RCA is set to "Yes". If true, this policy will set the "Is RCA Required" field to "Yes" and make it read-only.
Using this approach, the RCA field will act as a persistent indicator of whether Priority was set to 1 at any point in the incident lifecycle, ensuring Is RCA Required is accurately set and remains read-only as needed.
Creating a new field(RCA) on incident table:
UI policy in list view:
UI policy 1: configuration setup
Short description: set RCA if priority is critical
order: 100
Condition: priority is 1-critical
Reverse if false: unchecked
function onCondition() {
// Set RCA field to "Yes"
g_form.setValue('u_rca', 'Yes');
}
UI policy 2: configuration setup
Short description: If RCA is set to Yes
order: 200
Condition: RCA is Yes
Reverse if false: unchecked
function onCondition() {
// Set u_is_rca_required field to "Yes"
g_form.setValue('u_is_rca_required', 'Yes');
// Make u_is_rca_required field read-only
g_form.setReadOnly('u_is_rca_required', true);
}
"If you found my answer helpful, please give it a like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 01:31 AM
Hello @afreen shaik
The best way to approach this type of question is to use UI policy. This approach requires minimum scripting. Here is the attached screenshots to show the configuration setup in Ui Policy.
1) UI policy configuration setup:
2)Ui policy Script:
function onCondition() {
// Set RCA field to "Yes"
g_form.setValue('u_rca', 'Yes'); //modify the field name
// Make RCA field read-only
g_form.setReadOnly('u_rca', true); //modify the field name
}
This will change the "Is RCA required" field to Yes and make it read only at any point the priority becomes critical-1. Once the RCA is set to Yes it will always be Yes and read only.
"If you found my answer helpful, please give it a like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 01:56 AM
Hello Juhi Poddar,
Thanks for your response.
The "Is RCA required" field should be set to "Read-only" and "yes" when the priority is "P1" at any point in the incident cycle. But the conditions are not as per the requirement.
Note: Even if the priority changes from P1 to P2 or P3 or P4
Best Regards,
Afreen Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 02:08 AM
Hello @afreen shaik
- Thinking in a way that once the priority becomes p1 -> RCA is set to Yes.
- So now if at any moment RCA is 'Yes' that means the priority has been to P1 before at any point of lifecycle.
- Condition 2 checks that RCA is Yes, if it is Yes means it should never be changed to No and always be read only.
Condition 2 takes care of RCA if at any point the priority becomes P1. Even if the priority after that changes to P2, P3 or P4.
I would recommend to implement the solution once. This works in my PDI.
"If you found my answer helpful, please give it a like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 02:23 AM
Hello @Juhi Poddar
I have implemented and tested the scenario you have mentioned.
-> It is working when we first set the Priority to "P1" and then change to other priorities(P2,P3).
-> But, when we first set the Priority to "P2" and then manually set to "Yes", at that time, it should not be read-only , as it is not the "P1" but it is becoming "Read-only" which is not expected.
Best Regards,
Afreen Shaik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 09:04 AM
Hello @afreen shaik
After thoroughly analyzing the scenario and testing various approaches, I identified a solution to meet the requirement.
To implement this, follow these steps:
Create a new field (e.g., RCA) on the Incident table. This field can be hidden on the form, and it will store a value (such as "Yes") whenever the Priority is set to Critical (P1).
Set up a UI Policy to monitor the Priority field. When the Priority is "1", this policy will set the RCA field to "Yes".
Create another UI Policy that checks if RCA is set to "Yes". If true, this policy will set the "Is RCA Required" field to "Yes" and make it read-only.
Using this approach, the RCA field will act as a persistent indicator of whether Priority was set to 1 at any point in the incident lifecycle, ensuring Is RCA Required is accurately set and remains read-only as needed.
Creating a new field(RCA) on incident table:
UI policy in list view:
UI policy 1: configuration setup
Short description: set RCA if priority is critical
order: 100
Condition: priority is 1-critical
Reverse if false: unchecked
function onCondition() {
// Set RCA field to "Yes"
g_form.setValue('u_rca', 'Yes');
}
UI policy 2: configuration setup
Short description: If RCA is set to Yes
order: 200
Condition: RCA is Yes
Reverse if false: unchecked
function onCondition() {
// Set u_is_rca_required field to "Yes"
g_form.setValue('u_is_rca_required', 'Yes');
// Make u_is_rca_required field read-only
g_form.setReadOnly('u_is_rca_required', true);
}
"If you found my answer helpful, please give it a like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar