The example shows you how to retrieve all merge fields from a document and set their values. See pictures below how document looks like before and after update. See screenshot.