In step one of the store order details server behavior you should be choosing the detail order id as the unique id column. Then on step two where it is asking you for a value for this column you can either use the order session variable that looks like this:
$_SESSION["cartname_OrderID"]
You would need to use your cart name in place of the text for this.