- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:27 PM
Hello,
I've created additional columns within the Dependencies section for a few elements using the Grid Configuration method.
However, when I generate a PDF of a BIA, these columns are not appearing (only the default ones are).
How do I amend the script for fetching Dependency data within the PDF template [ ${template_script:getDependencySectionForBIA} ] in a way so that it can include the custom columns that I've created?
cc: @Connor Levien
Regards,
Mickey
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 08:29 PM - edited 08-07-2023 08:31 PM
hey @Mickey Goldstei,
Sorry for the delay responding its been a hectic week! You need to go to the "sn_doc_template_script" table (Document Template > Document Template Script in nav) and I would suggest copying the getDependencySectionForBIA script and making your own version. Using your new version you would have to modify the below glide record to look up the database view you made in the other question you raised to get the grid configuration variables
var biaDependenciesForGroup = new GlideRecord('sn_bia_dependency');
You would then need to update the below part of the script to add addition <th> elements and addition td element for you corresponding new fields from the database view.
if (biaDependenciesForGroup.hasNext()) {
tableBodyContent = '<tr>' +
'<th width="60%">' + 'Depends On' + '</th>' +
'<th width="20%">' + 'RRTO' + '</th>' +
'<th width="20%">' + 'RRPO' + '</th>' +
'</tr>';
while (biaDependenciesForGroup.next()) {
tableBodyContent = tableBodyContent +
'<td width="60%">' + biaDependenciesForGroup.getDisplayValue('depends_on') + '</td>' +
'<td width="20%">' + biaDependenciesForGroup.getDisplayValue('required_recovery_timeframe') + '</td>' +
'<td width="20%">' + biaDependenciesForGroup.getDisplayValue('required_data_backup') + '</td>' +
'</tr>';
}
tableBody = '<tbody>' + tableBodyContent + '</tbody> <br/>';
resultTable += tableOpenTag + tableBody + tableCloseTag + '<br/>';
}
Finally you would just have to update the below in the document template to whatever your new script is called.
[ ${template_script:getDependencySectionForBIA} ]
Let me know if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 01:20 PM - edited 08-03-2023 01:21 PM
From the script, edit to include the custom columns you created in the Dependencies section. You will probably need to use GlideRecord queries to access the custom columns within the Dependencies section. These columns are most likely stored in a separate table or fields. Next, you'll need to incorporate it into the PDF template's script.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 08:29 PM - edited 08-07-2023 08:31 PM
hey @Mickey Goldstei,
Sorry for the delay responding its been a hectic week! You need to go to the "sn_doc_template_script" table (Document Template > Document Template Script in nav) and I would suggest copying the getDependencySectionForBIA script and making your own version. Using your new version you would have to modify the below glide record to look up the database view you made in the other question you raised to get the grid configuration variables
var biaDependenciesForGroup = new GlideRecord('sn_bia_dependency');
You would then need to update the below part of the script to add addition <th> elements and addition td element for you corresponding new fields from the database view.
if (biaDependenciesForGroup.hasNext()) {
tableBodyContent = '<tr>' +
'<th width="60%">' + 'Depends On' + '</th>' +
'<th width="20%">' + 'RRTO' + '</th>' +
'<th width="20%">' + 'RRPO' + '</th>' +
'</tr>';
while (biaDependenciesForGroup.next()) {
tableBodyContent = tableBodyContent +
'<td width="60%">' + biaDependenciesForGroup.getDisplayValue('depends_on') + '</td>' +
'<td width="20%">' + biaDependenciesForGroup.getDisplayValue('required_recovery_timeframe') + '</td>' +
'<td width="20%">' + biaDependenciesForGroup.getDisplayValue('required_data_backup') + '</td>' +
'</tr>';
}
tableBody = '<tbody>' + tableBodyContent + '</tbody> <br/>';
resultTable += tableOpenTag + tableBody + tableCloseTag + '<br/>';
}
Finally you would just have to update the below in the document template to whatever your new script is called.
[ ${template_script:getDependencySectionForBIA} ]
Let me know if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 01:45 PM
Hello Connor,
Apologies for the late reply.
I've been toying with this, and I am able to get it work with a few other changes!
Upon running the script, I have the following output:
Relevant code:
if (biaDependenciesForGroup.hasNext()) {
tableBodyContent = '<tr>' +
'<th width="60%">' + 'Depends On' + '</th>' +
'<th>' + 'RRTO' + '</th>' +
'<th>' + 'RRPO' + '</th>' +
'</tr>';
while (biaDependenciesForGroup.next()) {
tableBodyContent = tableBodyContent +
'<td width="60%">' + biaDependenciesForGroup.getDisplayValue('dep_depends_on') + '</td>' +
'<td>' + biaDependenciesForGroup.getDisplayValue('var_variable') + '</td>' +
'<td>' + biaDependenciesForGroup.getDisplayValue('var_value') + '</td>' +
'</tr>';
}
Is there a solution where I can have var_variable values act as columns, and the var_value values be nestled in as values under those columns?
Ideally I'd want it to look something like this:
Depends On | Contingency Strategy | Description of Contingency Strategy |
Software: Musicmatch® Jukebox 9.0.2028 | Manual Workaround | Test |
Thanks!
Mickey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 04:34 PM
Hey Mickey,
Glad to see you were able to have a go at it. You can definitely achieve what you want to but because the way your biaDependenciesForGroup is set up its returning each variable as its own row and thats why you are getting the repeates. You will need to either update the logic of the function to group or you will need to in your script remember what "depends on" you are looking at as part of the while loop so you can merge the rows.
Below is an example of how you may tackle it using your script as a basis. Please not I havent tested this and no guarantee it works but its just to illustrate how it could be done.
if (biaDependenciesForGroup.hasNext()) {
tableBodyContent = '<tr>' +
'<th width="60%">' + 'Depends On' + '</th>' +
'<th>' + 'Contingency Strategy' + '</th>' +
'<th>' + 'Description of Contingency Strategy' + '</th>' +
'</tr>';
var currentDepends = '';
var contingencyStrategy = '';
var contingencyDescription = '';
while (biaDependenciesForGroup.next()) {
if (currentDepends == '') {
currentDepends = biaDependenciesForGroup.getDisplayValue('dep_depends_on');
}
if (currentDepends == biaDependenciesForGroup.getDisplayValue('dep_depends_on')) {
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Contingent Strategy') {
contingencyStrategy = biaDependenciesForGroup.getDisplayValue('var_value');
}
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Description of Contingency Strategy') {
contingencyDescription = biaDependenciesForGroup.getDisplayValue('var_value');
}
} else {
tableBodyContent = tableBodyContent +
'<td width="60%">' + currentDepends + '</td>' +
'<td>' + contingencyStrategy + '</td>' +
'<td>' + contingencyDescription + '</td>' +
'</tr>';
currentDepends = biaDependenciesForGroup.getDisplayValue('dep_depends_on');
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Contingent Strategy') {
contingencyStrategy = biaDependenciesForGroup.getDisplayValue('var_value');
}
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Description of Contingency Strategy') {
contingencyDescription = biaDependenciesForGroup.getDisplayValue('var_value');
}
}
}
}