When using Connect Action, The following script is usually used to get the reference the Chat Queue Entry,
For Example, when using the following script to the get the user who initiated the chat
var openedUser = conversation.document.opened_by //Gets the user who initiated the chat
After you have created the document for eg. incident (by clicking on the "Create Incident" Connect Action), This "document" object will point to the document that was created.
This is the expected behaviour document will refer to the current document the users are currently referring, After creating the incident the document is referenced to incident.