Hello @jjorczak
I don't think there is any way to insert a script via dynamic content, so unfortunately you need to modify some scripts and do some digging around to allow more tables to be visible.
What we did to add information from more tables (e.g. Cost plan table) is this:
First, I recommend copying the OOB Status report, not modifying it. Keep the OOB as it is in case you need it as some point. If you want, you can also set up that new Status report as the default one in the system properties.
There is an OOB script include that acts as an extension point called StatusReportDynamicTemplateDataProvider. (the original script is called StatusReportDynamicTemplateDataProviderSNC if you want to review the functions). In the function called _getQueryObj, you can see that only certain tables are allowed (risk_baseline, issue_baseline etc.) In the OOB configuration data is sourced from the respective baseline tables, for example risks are not displayed directly from the [risk] table, but from [risk_baseline]. Copy this entire function as it is to the extension point and modify it. Do not modify the StatusReportDynamicTemplateDataProviderSNC script include.
The queryObj variable is the query that will filter out data in the target table. Sadly only queries that are "field = x" are allowed. To add another table to the script, you can add the following line in the if structure (this example is for the cost plan table) :
// ....
// OOB SCRIPT
else if(tableName === 'issue_baseline' || tableName === 'project_action_baseline' || tableName === 'dmn_decision_baseline' || tableName === 'project_change_request_baseline')
queryObj['show_on_status_report'] = true;
// OOB SCRIPT
// ADD CUSTOM SCRIPT BELOW
else if (tableName === 'cost_plan')
queryObj = {
top_task: projectId
};
If you want, you can mimic the OOB logic and use the respective baseline table (e.g. cost_plan_baseline), but that depends on the use case and what you want to achieve. There is information above on how to create additional baseline tables.
For your table, simply replace 'cost_plan' with your table name. In the "top_task: projectID" line, replace 'top_task' with the field that connects your agile stories with the Project record. The 'Completed on last period' filter may be tricky, since only 'field = x' queries are allowed, so you will need to get creative. I'm not sure what you mean by last period (quarter perhaps?), but you might need to add a custom field to your table. That, or you can try modifying the following line to account for more filter types, although you need to be really careful and retain the OOB logic for all other cases except your table.
const [key, value] = queryFilter.split('=');
Once the script is done, you need to mess with your record in 'sn_doc_page_template'. The editor in the workspace will not allow you to add other tables, so you need to directly edit the JSON field. (find a JSON editor to make this easier). If you want to add a table, It's easier to create a table in the workspace editor and then replace the table name and the field names in the JSON editor. For example, for the cost_plan table, I added the following table:
{
"type": "table_row",
"content": [
{
"type": "table_cell",
"attrs": {
"colspan": 1,
"rowspan": 1,
"colwidth": null,
"background": null
},
"content": [
{
"type": "paragraph",
"attrs": {
"textAlign": null,
"indent": null,
"associatedRecordField": {}
},
"content": [
{
"type": "template_token",
"attrs": {
"table": "project_status.cost_plan",
"fieldPath": "name",
"queryFilter": "ADD YOUR FILTER HERE, NEEDS TO BE FIELD = X",
"displayValue": "Cost plan/Name"
}
}
]
}
]
},
{
"type": "table_cell",
"attrs": {
"colspan": 1,
"rowspan": 1,
"colwidth": null,
"background": null
},
"content": [
{
"type": "paragraph",
"attrs": {
"textAlign": null,
"indent": null,
"associatedRecordField": {}
},
"content": [
{
"type": "template_token",
"attrs": {
"table": "project_status.cost_plan",
"fieldPath": "FIELD YOU WANT TO DISPLAY",
"queryFilter": "ADD YOUR FILTER HERE, NEEDS TO BE FIELD = X",
"displayValue": "Cost plan/Cost type"
}
}
]
}
]
},
Add another table_cell construct for each column. In "table", replace cost_plan with your table name. In fieldPath, add the field you want to display on the column. In queryFilter add your query. If you did not modify the script accordingly, it needs to be in 'Field = X' format. This is where you will add a filter to only show the stories that were completed last period. The displayValue is what name will be displayed in the column title in the workspace editor (does not impact final status report).
This is by no way the optimal solution to this issue. As I mentioned above, the status report functionality is very limited at this point. Since this is a modification on an OOB function, you will need to review it for each upgrade and manually add in any modifications that happen on the OOB _getQueryObj function, or else you might run into issues. Depending on the business requirement, this might not even be worth it in the long run. You will need to consult with your team and decide accordingly.
UPDATE: It seems they changed it a bit s so for the Project workspace version 6.3.2 you also need to declare every additional table you are going to use in a function called 'dynamicTemplateSchemaTableConfig'. There is an OOB extension point called 'StatusReportDynamicTemplateSchema' so simply copy and paste the OOB function there and add your tables below.