- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 03:49 AM
Hi all,
I'm still a complete novice when it comes to customising the Portal so could do with a bit of guidance. I have been tasked with removing the button below from the Service Status page of the Portal if the Outage is planned (it must remain for unplanned outages - see below).
I'm not sure if this is edited on the page editor, or there should be a widget for the button. If it is a widget that needs editing - how can I find the name of this widget? Once in there I would suppose it's as easy as adding a condition to the script to not display on planned outages etc.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2022 08:01 AM
Hi,
Great job attempting yourself!
For the outage.type have you verified what the value actually is to ensure your ng-if is correct? In server you use "planned", in HTML you use "Planned Outage". If that's not correct, then none will be correct for it to show at all.
I'd recommend double-checking that to see.
I didn't clone the widget on my end to fully look at this but if the button is within a ng-repeat type iterator, then it should be fine and would be evaluated for each occurrence. You'd just want to make sure your values are lining up right.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 02:48 AM
Thanks Allen, I think you're right my condition doesn't seem to be registering with the correct value.
I've tried to debug the script to see what value is being returned but I'm getting nothing in the Chrome console. I've added the last 5 lines below at the end of the while outage loop (which I think is the right place to put it to ensure it's calculated for each outage).
I'm getting nothing in the Chrome console with this logging so wondering if I'm doing something wrong and its returning no value at all?
while (outage.next()) {
var out = {};
out.typeDisplay = outage.type.getDisplayValue();
out.type = outage.getValue("type");
out.details = outage.getValue("details");
out.ci = outage.cmdb_ci.getDisplayValue();
out.sys_id = outage.getUniqueValue();
out.taskid = outage.getValue("task_number");
out.task_type = outage.getDisplayValue("task_number");
out.serviceID = outage.getValue("cmdb_ci");
var tsknumGr = new GlideRecord("incident");
tsknumGr.get(out.taskid);
out.category = tsknumGr.getValue("category");
out.subcategory = tsknumGr.getValue("subcategory");
out.begin = outage.begin.getDisplayValue();
var loggedIncGr = new GlideRecord('task_outage');
loggedIncGr.addEncodedQuery("task.numberSTARTSWITHINC^task.opened_by=" + gs.getUserID() + "^outage=" + outage.getUniqueValue());
loggedIncGr.query();
var hasInc = loggedIncGr.next();
out.incident_number = hasInc ? loggedIncGr.task.getDisplayValue() : false;
out.incident_sys_id = hasInc ? loggedIncGr.getValue('task') : false;
data.outages.push(out);
data.outageIDs += "," + outage.getUniqueValue();
var outage_type = outage.getValue('type');
data.hideButton = true;
if(outage_type != 'Planned Outage'){
data.hideButton = false;
console.log(outage.type);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 04:41 AM
Finally got it working. So as it turns out, nothing needed to be done in the server script.
Instead I just needed to add && outage.type != 'planned'
<button ng-if="!outage.incident_sys_id && outage.type != 'planned'" type="button" class="btn btn-primary btn-sm pull-left" ng-click="c.createIncident(outage, $event);">I'm affected too</button>
Partly down to user error, I suppose because originally I used 'Planned Outage' rather than 'planned' (which you pointed out thank you!). And partly down to over complicating things with the server script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 06:16 AM
Hi,
Great, glad you got it!
Yeah, if you refer back up at the top, to my original post, I had only mentioned the HTML as well (in addition to basically the other steps that you needed to do), haha.
Take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 08:57 AM
Hello
Could you tell me what widget the 'I'm affected to' button appears in? I have stakeholders that would like to offer this functionality in the Portal but I can't seem to find it OoB.
Many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 09:08 AM
Hi Steve, the widget in question for my piece was called Current Status. Hope this helps!