Is it possible to create a Module Link to an outside URL using the RM API?
I would like to create a Module Link using the EXTERNAL_LINK_TO type to link to a URL. The description of RM.Data.createLink() doesn't seem to have a way to do this. This is the code I tried:
RM.Data.createLink(modRef, RM.Data.LinkTypes.EXTERNAL_LINK_TO, MY_URL, function(result) { if(result.code === RM.OperationResult.OPERATION_OK) { alert("success"); } else { alert("failure"); } });
This code returns a failure. Should I be formatting it differently or is there another function I can use?
Thank you
3 answers
Are you using RM Extension? Then, you need to make sure using the correct version (v4.0.5).
Also I think the EXTERNAL_LINK_TO should be a constant linkTypes.
Also I think the EXTERNAL_LINK_TO should be a constant linkTypes.
Comments
Yes, I am using v4.0.5.
I am not sure I understand what you mean about EXTERNAL_LINK_TO. Is my code incorrect? Can you suggest how it should be formatted?
From the API, I can see the EXTERNAL_LINK_TO is a constant type and format to use the constant value should be RM.Constants.EXTERNAL_LINK_TO.
Not sure if this is the cause of your issue but at least you could try :)
Unfortunately there is no way to create or remove external links in the current version of the API, I raised the following enhancement
RM API should offer a way to create and delete external links (84225)
RM API should offer a way to create and delete external links (84225)