Self-insemination
Self-insemination (also known as "selfing") is a mating behavior engaged in by individuals of multiple flatworm species, such as the free-living Macrostomum hystrix. Species that engage in this method of reproduction are hermaphroditic, meaning they possess both male and female reproductive organs. Selfing is referred to as a conditional reproductive strategy in this species, which means that there is a preference to reproduce with a mate. Sea slugs have also been found to reproduce through self-insemination. Mechanics 
Self-insemination has been demonstrated in isolated individuals of the flatworm species M. hystrix. This is achieved by using their male copulatory organ, a needle-like stylet, to pierce through the epidermis and into the parenchyma. Sperm is injected into the anterior region of their body due to physical limitations, which is inclusive of their own head. From the site of injection, sperm migrate posteriorly to the female reproductive organs (ovaries) where fertilization occurs. Flatworms that were studied in isolation contained significantly more sperm in their anterior region than those who were placed in triplet groups. As a conditional reproductive strategy 
M. hystrix has been shown to prefer outcrossing under normal conditions. Another study showed the onset of reproduction is significantly delayed in isolated individuals in comparison to those who were placed in triplet groups. There is also a reduction in the number of hatchlings produced through self-insemination and a decrease in the survival of these offspring, which suggests that this method of reproduction is costly to the parent. While survival of the species is more likely via their ability to produce offspring in the absence of potential mates, these offspring will further lack genetic variety. Therefore, members of this species avail of delayed self-insemination as a conditional reproductive strategy to endure through periods where mates are scarce. In sea slugs 
It may be beneficial for hermaphroditic species to seldom reproduce via self-insemination since they can avoid the laborious costs of reproduction to the female function as experienced through traumatic insemination ― such as in the case of the sea slug Alderia willowi. References 

Wikipedia Student Program
Mating systems
Platyhelminth biology
Mollusc anatomy