Since Java scripts have full access to the whole functionality, the script author may retrieve whatever linked records he needs. This gives the script developer more flexibility due to no constraints on multiple linked fields or depth of followed links and causes minimal performance impact as long as only the necessary data is retrieved.

However, it is not necessary to fill the linkholders - they will be reconstructed automatically from the values supplied to one or more of the Linked Field data columns. It is important here NOT TO COPY a set of values from the source record and change just some of them, as it may lead to links not being restored correctly.

In perl/exe scripts Linked Fields are exported like any other fields together with the linked record from the donor table. Please note, that the linked record is exported only for a single Linked Field for performance reasons.

To create a link it is enough to set a value to one of the Linked Field data columns, which is done in the same way as for any other field. For example, if you want to change the Assigned To for a record and the Linked Field data column is named 118_f_login; you can find this column name in Table wizard on Fields tab in column "Field name"; then put the following to the output file:

<field name= "_118_f_user_login"/>
   <value>Umbra</value>
</field> 

or if you are using Perl Script API call

EWset::setRecordField('_118_f_user_login','Umbra');

The script running engine will try to find the best matching record in the donor table and set the Linked Field link to that record. It works the same way for "multiple fields from other table" LF, but you are free to fill only a subset of LF columns. For example, if there are fields User Login and User Phone exported to your table, you may provide a value just for the User Login if you are sure it will result in an exact match.

This will always work for user login, since they are unique across each KB, but other fields could contain repeating values. In this case one has to fill additional fields to achieve a unique match, otherwise the first suitable match will be used.
If no match at all is found, the link will be left empty.

Related articles