Nesting Rest Resource in Asset Listing


(Harinder Singh) #1

Matrix Version: 6.51.0

I am trying to implement department pages with the Paint layout applied to them. The main setup is for our new Intranet website, but I created a test example for you to easily access since our Intranet is behind an access control list.

I am trying to make a REST call to pull the list of team members working under particular supervisors.

image

Setup:

  1. Paint Layout has been applied to the Information Services (Standard) page.
  2. Asset Listing has been nested in Paint Layout Body copy
  3. Rest Resource asset has been AL body copy

Issue:

The system is not passing the metadata value from (Link assets) to the nested REST asset to make a GET call. I have added a link above to a working example for you.

The following Teams folder where asset listing is looking for Link type assets and grabbing metadata value for Rest assets.

image

Can anyone please guide what step I am missing for Rest resource asset nested in AL?

I can provide more details if required. Thanks in advance


(Aleks Bochniak) #2

Harinder,

Can you share more information? We would need to see the how you’ve nested REST assets and how you’re passing the metadata values.

Aleks


(Harinder Singh) #3

1. Standard Page - Paint Layout Screen

Metdatada Screen

2. Paint Layout

3. Asset Listing - Default Format Bodycopy

Rest Resource Asset

URL: https://graph.microsoft.com/v1.0/users/%globals_get_Team_id%?$expand=directReports($select=displayName,jobTitle)&$select=displayName,jobTitle,extension_00c20747ec0f41619d1d6d26ceb348ef_hCCCUSTTeam

JS
var teamId = ‘%globals_get_Team_id%’;
// Function to generate HTML
let response = JSON.parse(_REST.response.body);

let filtered = [];

function generateHTML(data) {
    let html = `<div class="team">`;
    html += `<div class="team__name">${data.extension_00c20747ec0f41619d1d6d26ceb348ef_hCCCUSTTeam}</div>`;
    html += `<div class="team__supervisor">`;
    html += `<h4 class="team__supervisor-name">${data.displayName}</h4>`;
    html += `<span class="team__position">${data.jobTitle}</span>`;
    html += `</div>`;
    html += `<div class="team__report-to">`;

    data.directReports.forEach(member => {
        html += `<div class="team__member">`;
        html += `<span class="team__member-name">${member.displayName}</span>`;
        html += `<span class="team__member-position">${member.jobTitle}</span>`;
        html += `</div>`;
    });

    html += `</div></div>`;
    return html;
}

// Generate HTML and store in a variable
const teamHTML = generateHTML(response);
print(teamHTML);

#4

I think try %globals_asset_metadata_Team_id% for the additional GET value
and %nested_get_Team_id% in the nested asset.