Fusing the organic compound with metallic sodium converts covalently bound elements ($$\text{N, S, X}$$) into ionic sodium salts:
$$\text{Na} + \text{C} + \text{N} \xrightarrow{\Delta} \text{NaCN}$$
$$2\text{Na} + \text{S} \xrightarrow{\Delta} \text{Na}_2\text{S}$$
$$\text{Na} + \text{X} \xrightarrow{\Delta} \text{NaX} \quad (\text{where } \text{X = Cl, Br, I})$$