From the help...
@GetDocField(@InheritedDocumentUniqueID;"BeneficiaryName")
You just need to ensure that the 'child' form has the "Formulas inherit values from selected document" property selected on the Default tab of the Form Properties box.
In your particular example, you could have a 'Computed When Composed' field that has the formula: @Text( @InheritedDocumentUniqueID )
You could then simply replace that value for the 'doc.ParentDocumentUNID' value you used originally.
Hope that helps!