Thats b/c you included line 13 in the linkingtofolder method. Try commenting it out. As long as you are executing super.doSave after your custom doSave, it will save the object implicityly.
Hi Johnny Gee
Thanks for the Reply
line13 actually saves the all older versions (one by one) and dosave saves thecurrent version of the object (which is checked out and checked in)
if we comment the line 13 , it means i am not saving the older version after linking to folder and hence the older versions will not move to the new folder.
how to proceed on this?
Regards
Swarup
Try moving line 13 after the call
docheckin(){line 3:calling my method for linking to folder
line 13: saveline 4:calling super.docheckin method}
I have found that its a lot of trial an error when trying to deal with overriding methods. I have also used flags to help determine what parent methods are being called, such that you dont execute doSave recursively.
HI Johny Gee
Thanks for the reply
Line 13 is in the while loop, where it saves each version , if the document has 10 versions then the while loop will take each object id of 10 versions and get the instance of the each version object and there by linking to folder and then saving it by obj.save in line 13.
do you want me to remove line 13 in the loop and put in the do checkin as follows, here i should write as this. save or just save() in docheckin method?
i will try with by putiing save() and this.save() in docheckin and will post the results, and also any change is needed in dosave() method?
did i misunderstood any thing? please let me knowif it is.
HI Johny Gee,
i had tried moving the line 13 as you said, but it is not saving my older versions after linking to folder. then i tried with some flags and it is working as expected.
the code is as follows
flag=true
dosave(){if(document is newly imported, checked by isnew method){line 1:my logic }
if(flag=true)
{
line 2:calling my method for linking to folder}
calling super.dosave method}
docheckin(){
line 3:calling super.docheckin methodline 4:calling my method for linking to folder}
mymethod for linkingtofolder(){line 5:logic for getting the folder idline 6:this.unlink(this.getfolderid(0));line 7:this.link(folderid, from line )line 8:idfcollection coll = this.getversions("r_object_id");line 9:while(coll.next){line 10:getting each object idline 11:unlinking the each object from eachfolderline 12:linking to new folder
line 13:flag=false;line 14:save the object
}
Now the above TBO is getting initiated when i cehckin as sameversion / newversion and also when i change the properties and click save button.
am i violating any best practice in the above logic?
any thing to be taken care.
waiting for reply