3

Does anyone know a solution to return a component tcm to a component link field. There is a solution in the tridion documentation but only to return a value to a text field. Tridion says is possible but they dont provide a clear answer in our ticket. Can anybody please help on that?

3
  • Can you elaborate on what exactly you are trying to do?
    – Ant P
    Commented Jul 28, 2014 at 10:39
  • We have a custom page that convets a page url to uri's. Actually it finds the page in tridion and displays all the component uri's that are on the page. From there we want to return the value of the first component to a component link field Commented Jul 28, 2014 at 11:08
  • It is a custom pop from a component link field. The only solution that tridion provides is only for text field Commented Jul 28, 2014 at 11:10

1 Answer 1

9

I've had a quick play with this on a Component Link field, and it is very easy. All you have to do is pass in the TCM ID as the parameter into setValues function as follows:

var fields = window.dialogArguments.getFields();
if (fields && fields.length > 0) {
    fields[0].setValues(["tcm:7-3233"]);
}

This will set the component as the xlink in the Component Link field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.