0

im using XplatGenerateReleaseNotes plugin for my release notes in AzureDevops.

Im using the return_parents_only helper but its not working, and i dont know why...

Here is my template:

## Return Parents Only 
{{#return_parents_only this.workItems this.relatedWorkItems}}
{{#if (or (contains (lookup this.fields 'System.WorkItemType') 'User Story') (contains (lookup this.fields 'System.WorkItemType') 'Feature'))}}
{{#if (eq (lookup this.fields 'Custom.IncludeinReleaseNotes') true)}}
{{json this.fields}}
{{#with fields}}
* **{{{get 'System.Title' this}}}:** {{{sanitize (get 'Custom.ReleaseNotes' this)}}}
{{/with}}
{{/if}}
{{/if}}
{{/return_parents_only}}

Here is my customHandlebarsExtensionCode in regenerate-release-notes.yml:

customHandlebarsExtensionCode: |
         module.exports = {
             return_parents_only(array, relatedWorkItems, block) {
                 var ret = ''; 
                 var foundList = [];
                 for (var arrayCount = 0; arrayCount < array.length ; arrayCount++) {
                     for (var relationCount = 0; relationCount < array[arrayCount].relations.length; relationCount++) { 
                         if (array[arrayCount].relations[relationCount].attributes.name == 'Parent') { 
                             var urlParts = array[arrayCount].relations[relationCount].url.split("/");
                             var id = parseInt(urlParts[urlParts.length - 1]);
                             var parent = relatedWorkItems.find(element => element.id === id);
                             if (!foundList.includes(parent)) {
                                 foundList.push(parent);
                                 console.log('--------------------- Item added')
                                 ret += block.fn(parent);
                             }
                         }
                     }
                 }; 
                 return foundList;
             },
             stripHtml(fields, field) {
                 return fields[field].replace(/(<([^>]+)>)/gi, "");
             }
        
         }

Any ideas?

I except to have the Parent WIs of my WIs of type task associated in my PR

0 Answers0