How to update custom taxonomy meta using ACF update_field() function or any other wordpress function

I figured it out somehow..

Syntax of update_field():

update_field($field_key, $value, $post_id)

MY MISTAKE:
I was using the wrong parameter for the $post_id which i thought was the Term Id of the custom taxonomy term.

CORRECT USAGE: rather than using term id ($term_id in my question), one should use a string with the taxonomy preppended to the $term_id

ie $post_id = $taxonomy.'_'.$term_id

for eg: if your custom taxonomy is foo and the term id is 123

then : $post_id = foo_123

Hope this is helpful for someone.

This is the first time I’m asking/answering a question here.