The exploration of electromagnetic field influences on material characteristics remains a pivotal concern within scientific investigations. Nonetheless, in the realm of computational condensed matter physics, traditional density functional theory's extrapolation to scenarios inclusive of external electromagentic fields poses considerable challenges. These issues largely stem from the disruption of translational symmetry by external fields inherent in periodic systems, rendering Bloch's theorem inoperative. Consequently, the employment of first-principles methodologies in calculating material properties in the presence of external fields becomes an intricate task, especially in circumstances where the external field cannot be approximated as a minor perturbation. Over the past two decades, a significant number of scholars within the field of computational condensed matter physics have dedicated their work towards the formulation and refinement of first-principles computational methodologies adept at handling periodic systems subjected to finite external fields. This paper endeavors to systematically recapitulate these theoretical methodologies and their application across a broad spectrum including, but not limited to, ferroelectric, piezoelectric, ferromagnetic, and multiferroic domains. In the initial segment of this paper, we provide a succinct exposition on modern theory of polarization and delineate the process of constructing two methodologies for computations in finite electric fields predicated on this theory in conjunction with density functional theory. The succeeding segment delves into the integration of external magnetic fields into density functional theory and examines the accompanying computational procedures alongside the challenges they present. In the third segment, we firstly reflect on the first-principles effective Hamiltonian method, prevalent in the study of magnetic, ferroelectric and multiferroic systems, along with its adaptations for situations involving external fields. Concluding the paper, we introduce the exciting developments in constructing effective Hamiltonian models using neural network methods from machine learning, and their extensions under consideration of external fields.