I suspect the OP really wants to copy the contents of the field.
Here is how I would do it:
Before Create Trigger code:
SaveRecord(entry());
Before Update Trigger code:
SaveRecord(entry());
Shared Script code:
function SaveRecord(e) {
// Fetch the list of pointers to the remote entries through the local link field (even if there is only one)
var entries = e.field("LinkFieldName");
if (entries.length > 0) { // ensure there is a link
var r = entries[0]; // Get the first pointer
r.set("RemoteFieldName", e.field("LocalFieldName")); // Sets the contents in the remote entry
}
}
This assumes that there is only one linked remote record. If you do not have that embedded link, then you would have to do a "libByName("namne").find" type operation.