Question: a xpages contain view, and a button with simple action: deleted selected documents

the question: how to insert another action before deleting process, because I need to delete documents on other database.

The docs will be deleted on other database have the same subject the documents will be deleted in view

How to insert another action for it?

Thank you

Answer: 
You need to define the desired number of actionGroups. Something like this: 

```
 <xp:button value=" My Button" id="button1">
       <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
            <xp:this.action>
                   <xp:actionGroup>
                        <xp:executeScript>
                            <xp:this.script><![CDATA[#{javascript://your code in javascript - before the delete method]]>
                            </xp:this.script>                                          
                        </xp:executeScript>     
                    </xp:actionGroup>
                    <xp:actionGroup>
                        <xp:actionGroup>
                            <xp:deleteSelectedDocuments view="viewPanel1"
                                    message="Confirm?">
                            </xp:deleteSelectedDocuments>
                    </xp:actionGroup>
            </xp:this.action>
</xp:button>

```
You can use the the following code to get a handle to the selected documents in view. No you can delete documents in an other database and after that you can delete the document.

```
var docIds = getComponent("view1").getSelectedIds()
for(var i=0; i< docIds.length; i++){
    var doc:NotesDocument = database.getDocumentByUNID(docIds[i]);

    //Manipulating other documents

    doc.removePermanently(true)
}

```