How to get the id from the custom category?

I fixed it by using the following code:

$current_term = $wp_query->get_queried_object();    
$termid = $current_term->term_id;

Works quite well