Nils Agaton Heurlin (1801-1858), protokollsekreterare, advokatfiskal