Need to know how to get another/new line created for a report dashboard portal/url.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 01:21 PM
Hello -
sorry, this is hard to explain. I have a page that was created using a widget (by a colleague) and sporadically we are enhancing it (add new columns, clean up bad data, make sure it's pulling the right data).
Added an attachment that shows you what it looks like.
If you look at the bottom of the report/page you will see it says Risks and Mitigation Strategy. That there is supposed to take the data from the description field (for Risk) and mitigation plan (Mitigation Strategy) field on a Project and put that data on the portal/page.
However, you can have multiple Risks on a Project. and we need all of them to display when they are there. Right now, we only get one line. If you look at the screen shot, it's actually pulling the description from 2 Risks and putting the data there (as well as Mitigation Strategy field). I am trying to find out a way to split that into different/new lines.
I have been told it needs some adjusting on the HTML portion of the widget...possibly the Server Script as well.
Looking for suggestions on how this would look and what is needed to be done.
Thank you
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 04:41 AM
Hi,
You have shared the screenshots but actual magic is scripted in your widgets. You need to modify the custom widget as per your requirement. As this is big change and something custom solution you need to make required changes and let us know if anything is not working.
If you don't mind, can you please share below information?
What have you tried? What is working? What isn't working?
Have you tried putting log statements to see where it is reaching ?
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 06:44 AM
What does work is that the data from Risks and Mitigation Strategy field get populated and get populated with the correct value/data. However, it's taking the data from both Risks on the Project and jumbling it up on one line. If you look at the report, it has "I love the RISK involved YAY!" on the line...the first Risk has "I love the Risk involved" and the second has "YAY!" Need that "YAY!" to be on a 2nd line. See here on the project, what I am talking about...same goes for the Mitigation Strategy field...
That's what's working, the data getting pulled, what's not is the data getting separated 🙂 Have been trying by putting line breaks in the HTML with no luck (HTML is not my cup of tea).
Here's the HTML code portion...
And then the portion of code in the server script where it's being referenced...
That's where we are at at this point. 🙂
Hope that helps...anxious to see what you have to say. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 07:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 08:13 AM
My apologies,
Didn't see the snippet option in the widget.
But here is the server script code...
//Get Risk fields
var gr_risk = new GlideRecord('risk');
gr_risk.addQuery('task', gr_project.getUniqueValue());
gr_risk.orderByDesc('sys_created_on');
//gr_risk.setLimit(1);
gr_risk.query();
var mitigation = [];
//var slips = [];
var allRisks = [];
while (gr_risk.next()) {
mitigation.push(gr_risk.getDisplayValue("mitigation") ? gr_risk.getDisplayValue("mitigation") : 'N/A');
allRisks.push(gr_risk.getDisplayValue('description'));
//slips = (gr_risk.getDisplayValue("description")) ? gr_risk.getDisplayValue("description") : 'N/A';
}
obj.risk_description = allRisks.join('\n');
obj.risk_mitigation = mitigation.join('\n');
data.project_value.push(obj); //pushing object into array
}
}
and the HTML portion...
<div class="label-column">
<h5>${Risks}</h5>
</div>
<div class="value-column bold">
{{data.risk_description}}
</div>
</td>
<td>
<div class="label-column">
<h5>${Mitigation Strategy}</h5>
</div>
<div class="value-column bold">
{{data.risk_mitigation}}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>