- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I need to configure the new and Delete Button that are present in the Related list of the project workspace . I want these buttons to be shown only when the state of the project is open/work In progress I have checked all the declarative actions . and also create one ,But I was not able to achieve it . can any one help me to Achieve this.
Below is the screenshot of the buttons that I need to hidden . From the project workspace when project state is
closed complete/closed Incomplete
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Trupti Krishnam ,
You can achieve by performing below steps :
1. Firstly you need too tell global Action config not to have "New" button for your table, in our case is pm_project_task. This will make sure when you add your own custom declarative action system will make sure no duplicate Button is present. This You can achieve by navigating to following global action assignment - "<YourInstance>/sys_declarative_action_assignment.do?sys_id=5555b77273131010a0a79329faf6a780&sysparm_view=advanced". Then scroll down to Action exclusion and your table i.e. pm_project_task as shown in screenshot -
2. After performing above steps you will see that "New" Button is no more seen on the related list of pm_project_task in the details tab. Now that is hidden, you will have to write your custom declarative assignment for the new record of pm_project_task by binding it properly to the action config specific to Project workspace. Follow below steps to achieve it -
2a. Change the scope from global to Project Workspace.
2b. Navigate to action config record for PWS. Use this URL - (<YourInstance>/sys_ux_action_config.do?sys_id=cbb8c1b1a3e231109b37765346fcdaac&sysparm_record_target=sys_ux_action_config&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=sys_idSTARTSWITHcbb8c1b1a3e231109b37765346fcdaac%5EORDERBYname)
2c. Scroll to "All declarative action assignment" and click on new.
2d. Now create a new sys_declarative_action_assignment record for pm_project_task with attributes as screenshot (NB: Specify Client Action to be mapped correctly to PWS sys_declarative_action_payload_definition record. In our case it is "CREATE_NEW_RECORD" - URL (sys_declarative_action_payload_definition.do?sys_id=08913e7273131010a0a79329faf6a78b&sysparm_view=advanced) )
2e. Go to advance view of this new declarative action assignment and apply your desired Record Condition for example : Parent.State is Work in progress OR Parent.State is Open
3. Now that you have configured everything properly, you should be able to achieve this use case. Navigate to PWS again check the related list of project task, if it is working as expected like this -
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Thanks & Regards,
Arijeet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In Project Workspace, the “New” and “Delete” buttons that appear on related lists (like Tasks, Risks, Issues, etc.) are controlled by Declarative Actions and UI Builder settings, not by classic UI Actions. You can hide these buttons based on Project State using the following methods:
------------------------------------------------------------
Option 1 – Declarative Action Visibility Conditions (Recommended)
------------------------------------------------------------
1. Go to **Now Experience Framework → Declarative Actions → Action Sets**.
2. Find the Action Set linked to the related list (e.g., Project Tasks).
3. Open the **New** and **Delete** actions.
4. In the **Visibility Conditions** section, add:
```
${record.state} != 'closed_complete' && ${record.state} != 'closed_incomplete'
```
Or use numeric values if applicable:
```
${record.state} != 4 && ${record.state} != 5
```
5. Save and publish the Action Set.
6. Refresh the Project Workspace — the buttons will now hide when the project is closed.
------------------------------------------------------------
Option 2 – Conditional Rendering in UI Builder
------------------------------------------------------------
1. Open **Project Workspace** in **UI Builder**.
2. Select the **Related List** component.
3. Locate the visibility condition setting.
4. Add:
```javascript
${data.record.state != 'closed_complete' && data.record.state != 'closed_incomplete'}
```
5. Save and test the workspace — actions will display only for open projects.
------------------------------------------------------------
Option 3 – Client Script (Fallback)
------------------------------------------------------------
If UI Builder or Declarative Actions are unavailable, add a UI Script:
```javascript
function onLoad() {
var state = g_form.getValue('state');
if (state == 'closed_complete' || state == 'closed_incomplete') {
hideRelatedListButtons();
}
}
function hideRelatedListButtons() {
var buttons = document.querySelectorAll('[aria-label="New"], [aria-label="Delete"]');
buttons.forEach(btn => btn.style.display = 'none');
}
```
⚠️ Use only as a last resort — DOM manipulation is not upgrade-safe.
------------------------------------------------------------
Best Practice Summary
------------------------------------------------------------
| Method | Configuration Area | Recommended |
|--------|---------------------|--------------|
| Declarative Actions | Action Set | ✅ Best Option |
| UI Builder | Component Visibility | ✅ Good Alternative |
| Client Script | Classic Form | ⚠️ Fallback |
------------------------------------------------------------
✅ Summary
------------------------------------------------------------
- Use Declarative Actions or UI Builder to control visibility dynamically.
- Avoid script-based DOM manipulation.
- Document visibility logic for maintainability.
Result: “New” and “Delete” buttons appear only for projects in **Open** or **Work In Progress** states, and stay hidden for **Closed Complete** or **Closed Incomplete** projects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
So you overridden the OOTB New button for your table
There are you not able to add condition for Parent field?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Trupti Krishnam ,
You can achieve by performing below steps :
1. Firstly you need too tell global Action config not to have "New" button for your table, in our case is pm_project_task. This will make sure when you add your own custom declarative action system will make sure no duplicate Button is present. This You can achieve by navigating to following global action assignment - "<YourInstance>/sys_declarative_action_assignment.do?sys_id=5555b77273131010a0a79329faf6a780&sysparm_view=advanced". Then scroll down to Action exclusion and your table i.e. pm_project_task as shown in screenshot -
2. After performing above steps you will see that "New" Button is no more seen on the related list of pm_project_task in the details tab. Now that is hidden, you will have to write your custom declarative assignment for the new record of pm_project_task by binding it properly to the action config specific to Project workspace. Follow below steps to achieve it -
2a. Change the scope from global to Project Workspace.
2b. Navigate to action config record for PWS. Use this URL - (<YourInstance>/sys_ux_action_config.do?sys_id=cbb8c1b1a3e231109b37765346fcdaac&sysparm_record_target=sys_ux_action_config&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=sys_idSTARTSWITHcbb8c1b1a3e231109b37765346fcdaac%5EORDERBYname)
2c. Scroll to "All declarative action assignment" and click on new.
2d. Now create a new sys_declarative_action_assignment record for pm_project_task with attributes as screenshot (NB: Specify Client Action to be mapped correctly to PWS sys_declarative_action_payload_definition record. In our case it is "CREATE_NEW_RECORD" - URL (sys_declarative_action_payload_definition.do?sys_id=08913e7273131010a0a79329faf6a78b&sysparm_view=advanced) )
2e. Go to advance view of this new declarative action assignment and apply your desired Record Condition for example : Parent.State is Work in progress OR Parent.State is Open
3. Now that you have configured everything properly, you should be able to achieve this use case. Navigate to PWS again check the related list of project task, if it is working as expected like this -
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Thanks & Regards,
Arijeet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
@arijeetdev Thank you so much!! for the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In Project Workspace, the “New” and “Delete” buttons that appear on related lists (like Tasks, Risks, Issues, etc.) are controlled by Declarative Actions and UI Builder settings, not by classic UI Actions. You can hide these buttons based on Project State using the following methods:
------------------------------------------------------------
Option 1 – Declarative Action Visibility Conditions (Recommended)
------------------------------------------------------------
1. Go to **Now Experience Framework → Declarative Actions → Action Sets**.
2. Find the Action Set linked to the related list (e.g., Project Tasks).
3. Open the **New** and **Delete** actions.
4. In the **Visibility Conditions** section, add:
```
${record.state} != 'closed_complete' && ${record.state} != 'closed_incomplete'
```
Or use numeric values if applicable:
```
${record.state} != 4 && ${record.state} != 5
```
5. Save and publish the Action Set.
6. Refresh the Project Workspace — the buttons will now hide when the project is closed.
------------------------------------------------------------
Option 2 – Conditional Rendering in UI Builder
------------------------------------------------------------
1. Open **Project Workspace** in **UI Builder**.
2. Select the **Related List** component.
3. Locate the visibility condition setting.
4. Add:
```javascript
${data.record.state != 'closed_complete' && data.record.state != 'closed_incomplete'}
```
5. Save and test the workspace — actions will display only for open projects.
------------------------------------------------------------
Option 3 – Client Script (Fallback)
------------------------------------------------------------
If UI Builder or Declarative Actions are unavailable, add a UI Script:
```javascript
function onLoad() {
var state = g_form.getValue('state');
if (state == 'closed_complete' || state == 'closed_incomplete') {
hideRelatedListButtons();
}
}
function hideRelatedListButtons() {
var buttons = document.querySelectorAll('[aria-label="New"], [aria-label="Delete"]');
buttons.forEach(btn => btn.style.display = 'none');
}
```
⚠️ Use only as a last resort — DOM manipulation is not upgrade-safe.
------------------------------------------------------------
Best Practice Summary
------------------------------------------------------------
| Method | Configuration Area | Recommended |
|--------|---------------------|--------------|
| Declarative Actions | Action Set | ✅ Best Option |
| UI Builder | Component Visibility | ✅ Good Alternative |
| Client Script | Classic Form | ⚠️ Fallback |
------------------------------------------------------------
✅ Summary
------------------------------------------------------------
- Use Declarative Actions or UI Builder to control visibility dynamically.
- Avoid script-based DOM manipulation.
- Document visibility logic for maintainability.
Result: “New” and “Delete” buttons appear only for projects in **Open** or **Work In Progress** states, and stay hidden for **Closed Complete** or **Closed Incomplete** projects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
@MaxMixali thank you so much for the solution!
