This is for AX 2012 but probably works for D365, I'm not sure. Give it a shot.
It literally takes an item id and gives you the attributes and values in those attributes. Pretty straight forward
static void DAXGetProductAttributes(Args _args)
{
EcoResProductAttributeValue ecoResProductAttributeValue;
EcoResAttribute ecoResAttribute;
EcoResValue ecoResValue;
ItemId itemId = 'A10021'; // This is a sample Item Id
InventTable inventTable = InventTable::find(itemId);
while select RecId from ecoResProductAttributeValue
where ecoResProductAttributeValue.Product == inventTable.Product
join Name from ecoResAttribute
where ecoResAttribute.RecId == ecoResProductAttributeValue.Attribute
join ecoResValue
where ecoResValue.RecId == ecoResProductAttributeValue.Value
{
info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));
}
}