- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 05:46 AM
Hy all,
I am struggling in UI builder and in UX Screen Condition to make the attachment SNC Screen not to be visible for incidents where assignment group has the "external" type (created by me).
I have tried in condition builder but here I did not find how to do a query on the incident table.
I tried creating a new Ux Screen Condition but it seems that the script does not take the parameters table and sysID.
Even a simple check :
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 05:57 AM
Check following script and do the needful changes and try:
// Check if the current record is an incident
if (params.table !== 'incident') {
return true; // Show screen for non-incident records
}
// Query the incident record to get the assignment group
var incidentGr = new GlideRecord('incident');
if (incidentGr.get(params.sysId)) {
var assignmentGroupId = incidentGr.getValue('assignment_group');
// Query the assignment group to get its type
var groupGr = new GlideRecord('sys_user_group');
if (groupGr.get(assignmentGroupId)) {
var groupType = groupGr.getValue('u_type'); // Assuming 'u_type' is the custom field
if (groupType === 'external') {
return false; // Hide screen if the group type is 'external'
}
}
}
return true; // Show screen by default
I hope my answer helps you to resolve your issue, if yes mark my answer helpful & correct.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:41 AM
Thank you for the script, the problem was that I did not map the parameters correctly in the UX screen condition and incident and sysID were not passed to the code:
{
"type": "MAP_CONTAINER",
"container": {
"table": {
"type": "DATA_OUTPUT_BINDING",
"binding": {
"address": [
"sowrecordctrl",
"table"
]
}
},
"sysId": {
"type": "DATA_OUTPUT_BINDING",
"binding": {
"address": [
"sowrecordctrl",
"sysId"
]
}
}
}
}
after I put this code in Parameter Mapping it worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 05:57 AM
Check following script and do the needful changes and try:
// Check if the current record is an incident
if (params.table !== 'incident') {
return true; // Show screen for non-incident records
}
// Query the incident record to get the assignment group
var incidentGr = new GlideRecord('incident');
if (incidentGr.get(params.sysId)) {
var assignmentGroupId = incidentGr.getValue('assignment_group');
// Query the assignment group to get its type
var groupGr = new GlideRecord('sys_user_group');
if (groupGr.get(assignmentGroupId)) {
var groupType = groupGr.getValue('u_type'); // Assuming 'u_type' is the custom field
if (groupType === 'external') {
return false; // Hide screen if the group type is 'external'
}
}
}
return true; // Show screen by default
I hope my answer helps you to resolve your issue, if yes mark my answer helpful & correct.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:41 AM
Thank you for the script, the problem was that I did not map the parameters correctly in the UX screen condition and incident and sysID were not passed to the code:
{
"type": "MAP_CONTAINER",
"container": {
"table": {
"type": "DATA_OUTPUT_BINDING",
"binding": {
"address": [
"sowrecordctrl",
"table"
]
}
},
"sysId": {
"type": "DATA_OUTPUT_BINDING",
"binding": {
"address": [
"sowrecordctrl",
"sysId"
]
}
}
}
}
after I put this code in Parameter Mapping it worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 05:48 AM
Hi,
i'm trying to use your code for my purpose: i got a custom table on hr agent workspace, and need to hide the attachment paperclip for new records (sys_id=-1): any advice?
Thanks in advace