To restrict incident closure from Service Portal

rishabh31
Mega Sage

Dear Team,

 

There is a Close Incident button on Service Portal

rishabh31_0-1683827360871.png

There is a field- Major Incident State (name: major_incident_state; Type: String; Choices: Accepted (value-accepted), Rejected (value-rejected)) on the INC table which is displayed on INC records.

 

The requirement is when the user clicks on the 'Close Incident' button, it checks on the record whether that INC record has major_incident_state is 'accepted' or not, if found 'accepted' then it displays the info msg and restricts the closure of that respective INC record else allows the successful closure of the INC record.

 

I have modified the OOB provided UI Action: Close Incident (see below screenshot)

rishabh31_1-1683827986523.png

This is working fine but only in the Desktop view NOT on Service Portal, I want this to work on both. So I analysed further and found this 'Close Incident' button which appears in Service Portal is coming through a Custom Widget, I tried to modify the widget's Server Script to achieve the requirement but failed.

 

Below are the 'Body HTML Template' and 'Server Script' for this custom widget which contains this 'Close Incident' button in service Portal.

 

Body HTML Template:

 

rishabh31_2-1683828398256.png

Server Script:

rishabh31_3-1683828513703.pngrishabh31_4-1683828583542.png

 

I am not good at Service Portal-related widgets scripting, I tried this from lines 17 to 27 but had no luck, please help me to modify this widget's responsible scripts or advise the steps to achieve the requirement.

 

Thanks in advance

 

 

 

1 ACCEPTED SOLUTION

Here's an example but you'll have to add the condition of Major Incident state = accepted to this. I don't know if that's a custom field but it's not one that was on my PDI:

NiaMcCash_1-1683850503669.png

 

NiaMcCash_0-1683850448649.png

 

View solution in original post

7 REPLIES 7

I don't know where that message is coming from on your platform/instance. You'll have to track it down to figure out how/when to disable it.

@Nia McCash  mam I just figured it out, please see below the screenshot and help me to modify this accordingly to restrict this message for INC record whose Major incident State is Accepted

rishabh31_0-1683899130678.png

 

 

Hi @Nia McCash Mam,

This is working fine now the message ''Incident INCXXXXX has been permanently closed'' is not displaying for the INC records which have Major Incident State= Accepted, this is achieved through the previous hint provided by you i.e., apply filter condition. So I applied a filter condition on this 'Caller Close' BR as 'Major Incident State IS NOT Accepted', rest kept all things as it remains (see screenshot below)

rishabh31_0-1683900198432.png

Now while testing, it works fine

- When the INC record has 'Major Incident State=Accepted', and tries to close the incident through button in Service Portal, it displays only message- 'This incident is being addressed through major incident process and it can be closed' and restricts that INC record closure. (Note- This is working the same for both Desktop and SP view)

 

- When the INC record has 'Major Incident State IS NOT Accepted', and someone tries to close the incident through button in Service Portal, it displays only the message- 'Incident INCXXXXX has been permanently closed' and allows that INC record for its successful closure. (Note- This is working the same for both Desktop and SP view)

 

Steps to fulfill this requirement-

- Create a new BR on INC table and fill/update configurations as below screenshots-

rishabh31_2-1683900772367.png

rishabh31_3-1683900839405.png

-Update the Filter Condition on already present BR, rest keep all things same as it is (shown in below ss):

rishabh31_4-1683900941723.png

 

-Also reinstate OOB UI Action (Close Incident) to its initial version (Shown in the screenshot below)

rishabh31_5-1683901098392.png

Thanks, further marking your response as correct and helpful.