- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone,
I’m trying to conditionally hide the "Add Request Change" button based on the project type.
The goal is to make the button visible only for specific project types, and hidden for others depending on predefined conditions.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @mohammadzey,
The buttons such as Add Issue, Add Decision, etc., are being rendered from the Scripted REST Resource(getConfig) available in the sys_ws_operation table.
Within the Scripted REST Resource, the RIDACWorkspace Script Include is being invoked. From this Script Include, the getRIDACConfig() method is responsible for returning the toolbar button configuration.
getRIDACConfig: function(topTaskId, parentTable) {
var ridacColumns = new RIDACColumns().get();
var canCreateRIDACList = [];
var ridacEntitesHasRecordsCount = 0;
const toolBarConfig = this._getToolbarConfig(topTaskId, parentTable);
var parentGr = new GlideRecord(parentTable);
parentGr.get(topTaskId);
if(toolBarConfig && !toolBarConfig.canRead){
return {
status: 'error',
statusCode: '403'
};
}
for(var i=0; i < this.ridacTables.length; i++) {
var table = this.ridacTables[i];
var gr = new GlideRecord(table);
if (table === 'risk') {
gr.addQuery('task', topTaskId);
} else {
gr.addQuery('parent', topTaskId);
}
gr.setLimit(1);
gr.query();
if(gr.getRowCount())
ridacEntitesHasRecordsCount++;
if(gr.canCreate()){
var ridac = {};
ridac.id = table;
ridac.label = gs.getMessage('Add {0}', this.typeMap[table]);
canCreateRIDACList.push(ridac);
}
}
return {
status: 'success',
statusCode: '200',
columns: ridacColumns,
config: this.getConfig(ridacEntitesHasRecordsCount),
toolbar: toolBarConfig,
groupBy: ['ridacType'],
moreActions: gs.getMessage('More actions'),
canCreateRIDACList: canCreateRIDACList,
parentDomain: parentGr.getValue('sys_domain'),
translationMap: this.typeMap
};
}You can enhance the logic as per your requirement inside the method.
If this helps, please mark it as Helpful or accept it as a Solution.
Regards,
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
it comes from this component, deep dive in UI builder and see
Those are not Declarative Actions
https://instanceName.service-now.com/now/builder/ui/edit/experience/8f7db3b507223010188ca2324dd300be/576c9b4a07623010188ca2324dd3008c/176c534a07623010188ca2324dd300b0
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
From here it will hide the full button "Add Risk" and what are under it, i only need to hide add request change and based on a condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you will have to see how the other 3 buttons are added by exploring that UI builder component and then handle the logic
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @mohammadzey
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti