← Back to Blog

Export Missing Required Components

The "Missing Required Components" window shown while exporting a solution doesn't offer a way to save the list.

Using this script, you can generate a tab delimited list which can then be copied into Excel

//when exporting a solution, list of missing items is shown but without a way to export the list of missing items

//use this to generate a list of "Missing Required Components"

//paste into the console window (F12) and copy the resulting output into Excel

function getcolval(col) {

    var text = "";

    try {

        var atag; var span;

        if (col.getElementsByTagName("a").length > 0)

            atag = col.getElementsByTagName("a");

        if (col.getElementsByTagName("span").length > 0)

            span = col.getElementsByTagName("span");

        text = (atag || [{ "innerText": "" }])[0].innerText;

        text += (span || [{ "innerText": "" }])[0].innerText;

    }

    catch (err) {

        console.log(err.message);

    }

    return text;

}

var dataset = [];

var exceltab = "";

var rows = document.getElementsByClassName("ms-crm-List-Row");

for (var x = 0; x < rows.length; x++) {

    var row = rows[x];

    var cols = row.getElementsByTagName("td");

    var datarow = {};

    if (x === 0) {

        exceltab += "Display Name\tName/Id\tType\tManaged Solution\tRequired by\r\n";

    }

    datarow.displayname = getcolval(cols[0]);

    datarow.nameid = getcolval(cols[1]);

    datarow.type = getcolval(cols[2]);

    datarow.managedsolution = getcolval(cols[3]);

    datarow.requiredby = getcolval(cols[4]);

    dataset.push(datarow);

    exceltab += datarow.displayname + "\t" + datarow.nameid + "\t" + datarow.type + "\t" + datarow.managedsolution + "\t" + datarow.requiredby + "\r\n";

}

//copy the console output into Excel cell A1 and it will parse automatically

console.log(exceltab);