The requirement is to print an extended description on a document if one has been entered, and if not to print the standard description. Of course this can be adapted for other purposes.
To do this we will create two new text fields:
x_studio_extended_description
(for the user to enter a description)x_studio_print_description
to print on the document.
Enable Developer Mode, navigate to Settings / Technical / (Automation) / Automated Actions and click on “create”.

if record.x_studio_extended_description:
record['x_studio_print_description'] = record.x_studio_extended_description
else:
record['x_studio_print_description'] = record.name