1
votes

I'm having a problem with saving a value to a field (either new one or existing one) to a current document which I'm selecting:

var selectedIDs = getComponent("viewPanel").getSelectedIds();
var doc:NotesDocument = database.getDocumentByID(selectedIDs[0]);
doc.replaceItemValue("Parentid","TEST VALUE");
doc.save;

When I use the replaceItemValue on a new document it works ok, but this is an existing mail document which I'm trying to stamp with a value (it will be ParentID -to assign it to another document) and it simply doesn't want to work

Any sugestions ? :)

1
Might be an access problem: are you allowed to save the document at all? You might also want to check what the response is of the doc.save() call: true (document is saved) or false (document could not be saved).Mark Leusink
please describe in detail what is the problem. does it raise error? how do you initialize doc variable? do you update/save doc in other event?Frantisek Kossuth
Re - Mark - Thanks I will check it, but I have all manager access rights to the database, so it shouldn't be a case.Swav
Re Frantisek - The problem doesn't rise an error, it just loads the page. This script is on OK button, it's louched from a Dojo dialog box with a view (list of documents for selection). The doc variable is initialised only here: var doc:NotesDocument = database.getDocumentByID(selectedIDs[0]) and I don't update or save the doc in any other events, just here.Swav
now I see... doc.save(), you have omitted parentheses.Frantisek Kossuth

1 Answers

4
votes

you are calling doc.save, what returns value of field "save" (or function object?). you have to call method doc.save()