incident variable editor (formatter) if blank then hide the section

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 09:35 PM
I have added the incident variable editor(formatter ) in one section of my incident form for the sow view.
Now if the incident is created from record producer then the variables are showing in the variables section that is fine.
But if the record is created normally by clicking on new the record doesn't have any variables but the section variables is shown which is not required.
I want if there are no variables present in the Variables section it should not be visible how i can achieve this?
@Ankur Bawiskar any suggestions?
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 10:02 PM
@Debasis Pati while creating an incident from record producer update the contact type as self-service or portal.
write a client script/ ui policy if contact type is self-service or portal show the variable section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 10:11 PM
Hi,
Create a UI policy on incident table
Display variables section only when channel is self-service

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 10:35 PM
This will work but is there any other way to identify if it is created from record producer or not because from backend also we can create a incident record putting the channel as self-service right in that case it will fail.
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 10:49 PM
Hi,
Another way is to use Display Business rule and client script
Display Business rule
(function executeRule(current, previous /*null when async*/ ) {
g_scratchpad.showVariables = false;
var grRec = new GlideRecord('sc_item_produced_record');
grRec.addEncodedQuery('task=' + current.getUniqueValue() + '^task.sys_class_name=incident');
grRec.query();
if (grRec.next()) {
g_scratchpad.showVariables = true;
}
})(current, previous);
OnLoad Client Script
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_scratchpad.showVariables){
g_form.setSectionDisplay('variables',true);
}
else{
g_form.setSectionDisplay('variables',false);
}
}