Hi,
It's ok but only if your custom field doesn't have / need translations and it's not a selector custom field (multiple dropdown, single dropdown, radio, checkbox, date picker, AJAX file, AJAX image, etc).
Otherwise, you need to do it like that:
$this->fieldsClass->show($sample_link_Config,$this->element->sample_link);
That way, the system will properly map the value from the database to what is supposed to be displayed (so instead of getting the value of the selected value, you would see the title of the selected value for a radio/dropdown/checkbox custom field).
Also, since you're doing a customization and you already know that the custom field is published, etc, I wouldn't bother with the first if. But it can be nice if you've working on someone else's website and the custom field could potentially be unpublished or its display settings could change in the future.