I built fortifications which my crossbowmen are standing immediatly behind (defending a burrow). When goblins come close the crossbowmen don't fire but leave the fortifications and chase the goblins. Is there a way to make them hold and also fire from fortifications?
Have you checked the angle? Dwarves can't fire at extreme angles (limited to roughly +-45 degrees) vertically. Have you checked line of sight? In other words, could trees, cliffs, etc be blocking the field of view? Have you checked that the dorfs have proper equipment, meaning bolts, quivers, AND crossbows? Have you checked the range? If the goblins are out of range your dwarves may try to exit the forst and get closer for firing. Range varies based on elevation and skill, but over 50 tiles is too far. Finally, lock the doors between crossbowdorfs and their enemies. Even with all these things being true, dwarfs are silly and the AI can have trouble positioning them on small ramparts for firing.