on 07-15-2015 11:42 AM
hi,
i'm doing something like this:
// remove all collaborators
collaborators = doc.getCollaborators();
collabIter = collaborators.iterator();
while (collabIter.hasNext()){
CollaboratorIBeanIfc collab = collabIter.next();
hashValue= collab.getCollaboratorType().hashCode();
try {
if ((!((hashValue == 2) && (collab.getCollaboratorRole().getDisplayName().contains(GROUP_ROLE)))) &&
(!((hashValue == 1) && (collab.getCollaboratorRole().getDisplayName().contains(OWNER_ROLE))))) {
collabIter.remove();
}
} catch(Exception e) {
e.printStackTrace();
log.setMethod("main");
log.setLogMessage(e.getMessage());
Logger.debug(log);
}
}
i wish to delete all groups and users with a owner role when saving the master agreement.
this script is working well. i execute this code on master agreement lifecycle event "saved".
when i press the save button all collaborators are deleted, but when i press the done button they are all back in my master agreement.
i have also try to use collab.delete() instead of collabIter.remove() but the behaviour was the same...
what i'm doing wronge here?
thanks
Waldemar
Hi,
i have exactly the same behaviour deleteing extension collections:
public void delExtensionCollection(IBeanIfc bean, String collectionName, String fieldName, String fieldValue) {
colln = bean.getExtensionCollection(collectionName);
for (iter = colln.size(); iter > 0; iter--) {
ExtensionCollectionMemberIfc extMember = colln.get(iter-1);
ExtensionFieldIfc extField = extMember.getExtensionField(fieldName);
if (extField.get().getDisplayName().equals(fieldValue)) {
colln.delete(extMember);
}
}
}
after the code is executed and i press save the collection is deleted. but after i press done the collection is back in master agreement...
Waldemar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Waldemar,
I would recommend avoiding the "Saved" lifecycle script, for doing changes to the document.
This is because the script executes 'after' the document is fully saved, and changes applied from the script may not reflect in the already opened document (changes should be visible if you refresh the document, aka search for it and reopen).
If possible, try to move your code to Validate lifecycle script, after all validations are passed.
In general, scripting the Saved lifecycle should be done very carefully and for specific usages (mainly background activities like notifications, applying changes to other associated documents).
Regards,
Bogdan
Hello Waldemar,
I guess there should be atleast one collaborator for an Master Agreement with "Owner" Collaborator role
Even while creating document security template it asks for the addition of owner role in collaborators.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hallo Raj,
what i wrote is obviously wrong
as you can see in the code i want to delete all other collaborators then"owner" and "owner group".
after the code is executed and the master agreement was saved there should be at lasst only two collaborators "owner" and "owner group"
sorry for missunderstanding...
Waldemar
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.