In an RM extension, is it possible to change the content (not attributes) of an artifact?
I would like to change the content (not attributes) of an artifact directly in an RM (DNG) extension. Is this possible? |
One answer
Yes. The Client API allows you to do this. To set the "Content," use Primary Text, which will is referenced as RM.Data.Attributes.PRIMARY_TEXT in your code. So if item is of type RM.ArtifactAttributes for your artifact, something like this will set the content.
var toSave = [];
item.values[RM.Data.Attributes.PRIMARY_TEXT] = "New Value of Content Here";
toSave.push(item);
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
// error handling code here
}
});
This is only a slightly edited version of the sample code for setAttributes in the Client Extension API here (https://jazz.net/wiki/bin/view/Main/RMExtensionsAPI605#SetAttributes). To get the RM.ArtifactAttributes data type(item above), as easy way to start is using RM.Client.showArtifactPicker to get the RM.ArtifactRef, and then give the result of this to RM.Data.getAttributes to get the RM.ArtifactAttributes.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.