Need to know how to get another/new line created for a report dashboard portal/url.

allentschumper1
Tera Contributor

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

13 REPLIES 13

Anil Lande
Kilo Patron

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

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

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...

find_real_file.png

 

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...

find_real_file.png

 

And then the portion of code in the server script where it's being referenced...

 

find_real_file.png

 

That's where we are at at this point.  🙂

Hope that helps...anxious to see what you have to say.  Thank you!

When sharing code it is best to past the code snippet icon. Instead of screenshots. That way we can copy the code and modify it.

find_real_file.png

allentschumper1
Tera Contributor

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>