Disable Send button in CSM portal

DoDo labs___
Mega Sage

Hi everyone,

Can someone help on how to hide send button in Service Portal if the case is in Resolved state?  Any help would be great!

 

DoDolabs____0-1711031278102.png

 

1 ACCEPTED SOLUTION

Aqib4
Kilo Guru

Hi @DoDo labs___ ,

To hide the send button in Service Portal based on the state of the case (e.g., Resolved state), you can achieve this by using Client Scripts or UI Policies. Below are the steps to accomplish this using UI Policies:

1. Create a UI Policy:
- Navigate to `Service Portal > Designer`.
- Select the page where the send button is located.
- Click on the widget containing the send button.
- In the widget properties, locate the field for which the UI policy needs to be applied (e.g., the send button).

2. Create a UI Policy:
- Go to `UI Policies`.
- Click on `New`.
- Provide a name and description for the UI Policy.
- Configure the conditions for when the UI policy should be applied. In this case, you'll want to base it on the state of the case. For example, if your case table is `incident` and the state field is `incident_state`, you can set the condition to `incident_state is Resolved`.

3. Define Actions:
- Under the `Actions` section of the UI Policy form, select `Hide` for the action. This will hide the send button when the conditions defined in the UI policy are met.

4. Save the UI Policy.

Once you've configured the UI Policy, the send button will be hidden on the Service Portal when the case is in the Resolved state.

Alternatively, you can use Client Scripts to achieve a similar outcome. Here's how:

1. Create a Client Script:
- Go to `Client Scripts`.
- Click on `New`.
- Provide a name and description for the client script.
- Set the `Applies to` field to the table containing the case records (e.g., `incident`).
- In the script section, write JavaScript code to hide the send button based on the case state. For example:

function onLoad() {
var caseState = g_form.getValue('incident_state');
if (caseState == 'Resolved') {
hideSendButton(); // Call function to hide the send button
}
}

function hideSendButton() {
// Replace 'sendButtonId' with the actual ID of the send button element
document.getElementById('sendButtonId').style.display = 'none';
}
```

2. Save the client script.

This client script will hide the send button when the case is in the Resolved state. Make sure to replace sendButtonId with the actual ID of the send button element in your Service Portal.

Choose the method (UI Policy or Client Script) that fits your requirements and implementation preferences.



Please hit helpful and accept this as a solution if solves your queries.

Regards: Raja Aqib

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, can you clarify your business driver\requirement?

I would expect that a customer would be able to update their Case until it was closed, and preventing comments from being added to an active task would result in an inconsistent\poor user experience.

Hi!

 

If they put an additional comment, when a ticket is in a resolved status, the helpdesk colleagues will not notice it.

 

DoDolabs____0-1711095306813.png

 

Aqib4
Kilo Guru

Hi @DoDo labs___ ,

To hide the send button in Service Portal based on the state of the case (e.g., Resolved state), you can achieve this by using Client Scripts or UI Policies. Below are the steps to accomplish this using UI Policies:

1. Create a UI Policy:
- Navigate to `Service Portal > Designer`.
- Select the page where the send button is located.
- Click on the widget containing the send button.
- In the widget properties, locate the field for which the UI policy needs to be applied (e.g., the send button).

2. Create a UI Policy:
- Go to `UI Policies`.
- Click on `New`.
- Provide a name and description for the UI Policy.
- Configure the conditions for when the UI policy should be applied. In this case, you'll want to base it on the state of the case. For example, if your case table is `incident` and the state field is `incident_state`, you can set the condition to `incident_state is Resolved`.

3. Define Actions:
- Under the `Actions` section of the UI Policy form, select `Hide` for the action. This will hide the send button when the conditions defined in the UI policy are met.

4. Save the UI Policy.

Once you've configured the UI Policy, the send button will be hidden on the Service Portal when the case is in the Resolved state.

Alternatively, you can use Client Scripts to achieve a similar outcome. Here's how:

1. Create a Client Script:
- Go to `Client Scripts`.
- Click on `New`.
- Provide a name and description for the client script.
- Set the `Applies to` field to the table containing the case records (e.g., `incident`).
- In the script section, write JavaScript code to hide the send button based on the case state. For example:

function onLoad() {
var caseState = g_form.getValue('incident_state');
if (caseState == 'Resolved') {
hideSendButton(); // Call function to hide the send button
}
}

function hideSendButton() {
// Replace 'sendButtonId' with the actual ID of the send button element
document.getElementById('sendButtonId').style.display = 'none';
}
```

2. Save the client script.

This client script will hide the send button when the case is in the Resolved state. Make sure to replace sendButtonId with the actual ID of the send button element in your Service Portal.

Choose the method (UI Policy or Client Script) that fits your requirements and implementation preferences.



Please hit helpful and accept this as a solution if solves your queries.

Regards: Raja Aqib