CreateArtifact API does not seem to work (callback never called)
I'm trying to use the CreateArtifact API:
window.alert("cccc");}); In this example the window.alert("cccc") is never called. What am I missing? Thank you |
2 answers
Hi,
I just found the answer, just add [0] to Mod_Ref :
var strategy = new RM.LocationSpecification(Mod_Ref[0], RM.Data.PlacementStrategy.BELOW);
But I don't know why yet.
I found the solution working on the RM.Data.Module.removeArtifact example.
Actually, for RM.Data.getContentsStructure and getContentsAttributes this is the same pb, just add [0]:
- RM.Data.getContentsAttributes(module[0],
- RM.Data.getContentsStructure(module[0].
Spend to much time on that...
Regards.
Comments
Donald Nong
commented Oct 27 '17, 3:52 a.m.
Is the same artifact (the module itself, or a module artifact within the module) selected in both cases?
|
Hi Donald,
For the getContentsStructure, I select a module in the "browse modules" page but without opening it. And it seems to me that I'm in the RM Web UI context because I added my openSocial Gadget through the project area window and my Gadget is on the left pane.
So what do I have to do to avoid adding the "[0]" ?
An other issue I found in the RM.Data.Module.moveArtifact code: is there a missing "});" instruction line for the structNodes.forEach(function(structNode) section ?
An other question; I'm trying to test the RM.Data.Module.moveArtifact code but when I select a Requirement artifact in a module I don't know (yet) how to retrieve the reference of the module containing this artifact to provide it to the flattenImmediateChildren function. Can you tell me how to do that ?
Regards.
|
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.
Comments
Have you subscribed the script to any events? Otherwise there is no way to call the script at all. Check the sample scripts for details.
The reason I asked the OP to check the sample code is he had the impression that RM Extension API works as normal JavaScript, which is incorrect.
Your one probably falls in the same category. The API usually only works in the RM Web UI context. I don't know how you invoke it from an OpenSocial widget, but the "null" object may suggest that when the function is called, no RM artifact (the intended object) is actually "selected".