DNG - RM Extension iterate over artifacts in module
I am trying to iterate over the artifacts in a module (so I can follow links from each artifact) using an RM extension.
I open the module so it is the current artifact at the start of the script then :-
RM.Client.getCurrentArtifact(function(ref)
{
RM.Data.getContentsStructure(ref, function(opResult)
{
opResult.data.forEach(function(row)
{
RM.Data.getLinkedArtifacts(row, [], function(linksResult) // OPERATION_BAD_REQUEST
{
// get data from linked artifacts
});
});
});
});
{
RM.Data.getContentsStructure(ref, function(opResult)
{
opResult.data.forEach(function(row)
{
RM.Data.getLinkedArtifacts(row, [], function(linksResult) // OPERATION_BAD_REQUEST
{
// get data from linked artifacts
});
});
});
});
I get a OPERATION_BAD_REQUEST from the call to RM.Data.getLinkedArtifacts(row, [], function(linksResult) when I do this because the 'row' parameter is apparently not an artifact.
The operation opResult.data.forEach does not seem to loop through artifacts. Is there any way to loop through the artifacts in a module and get a reference to each artifact in turn that can be used successfully with RM.Data.getLinkedArtifacts?