Trouble using actor.update with a DocumentID field
Hi All,
I have a link from on character to another with a doucment ID field.
When I drop on actor onto the other, I want to make the link.
This is my code snippet (irrelevant stuff cut to hopefully make it easy to read).
async _onDropActor(event, data) {
const uuid = data.uuid;
const droppedActor = await fromUuid(uuid);
const droppedActorId = droppedActor.id;
this.actor.update("system.placeholderID", droppedActorId);
I get this error
foundry-esm.js:11581 Uncaught (in promise) TypeError: Cannot create property '_id' on string 'system.placeholderID'
I have tried a few configurations / different things. What am I missing?
Thanks in advance
2 Replies
The parameter to update should be an object. Also, documentIdFields cast documents to their IDs, so no need to grab it explicitly. Should be
this.actor.update({ "system.placeholderID": droppedActor })
Thanks