TinyMCE custom button retrieve value from custom field

Rather than finding the custom field value when the user hits the button, change the [custom field value] to a shortcode name (perhaps “[mkay_subscription_button_value]”?) and then create a shortcode that can replace the value of that key with the post’s custom meta. Something like this:

function 246286_display_custom_field( $atts ) {
    $data = get_post_meta( get_the_ID(), 'mkay_custom_field', true );
    return $data;
}
add_shortcode( 'mkay_subscription_button_value', '246286_display_custom_field' );

The value of doing this is: if the post’s custom meta changes after the button has been pressed, the output on the page still remains valid.