Expand and collapse of outline entry

I’ve associated action to a outline entry. But when i click on outline entry it shoud expand all its child entries and if i click when it is expanded it should collapse. Is there any command?