Joseph's brothers went to tend their father's flocks near Shechem.
References for Genesis 37:12
Israel said to Joseph, "Aren't your brothers tending the sheep near Shechem? Come, I'll send you to them." And he said, "I'm ready."
Jacob said to him, "Go! Find out how your brothers are and how the flock is, and report back to me." So Jacob sent him from the Hebron Valley. When he approached Shechem,
a man found him wandering in the field and asked him, "What are you looking for?"
Joseph said, "I'm looking for my brothers. Tell me, where are they tending the sheep?"
The man said, "They left here. I heard them saying, ‘Let's go to Dothan.'" So Joseph went after his brothers and found them in Dothan.
They saw Joseph in the distance before he got close to them, and they plotted to kill him.
The brothers said to each other, "Here comes the big dreamer.
Come on now, let's kill him and throw him into one of the cisterns, and we'll say a wild animal devoured him. Then we will see what becomes of his dreams!"
When Reuben heard what they said, he saved him from them, telling them, "Let's not take his life."
Reuben said to them, "Don't spill his blood! Throw him into this desert cistern, but don't lay a hand on him." He intended to save Joseph from them and take him back to his father.
When Joseph reached his brothers, they stripped off Joseph's long robe,
took him, and threw him into the cistern, an empty cistern with no water in it.
When they sat down to eat, they looked up and saw a caravan of Ishmaelites coming from Gilead, with camels carrying sweet resin, medicinal resin, and fragrant resin on their way down to Egypt.
Judah said to his brothers, "What do we gain if we kill our brother and hide his blood?
Come on, let's sell him to the Ishmaelites. Let's not harm him because he's our brother; he's family." His brothers agreed.
When some Midianite traders passed by, they pulled Joseph up out of the cistern. They sold him to the Ishmaelites for twenty pieces of silver, and they brought Joseph to Egypt.
When Reuben returned to the cistern and found that Joseph wasn't in it, he tore his clothes.
Then he returned to his brothers and said, "The boy's gone! And I—where can I go now?"
His brothers took Joseph's robe, slaughtered a male goat, and dipped the robe in the blood.
They took the long robe, brought it to their father, and said, "We found this. See if it's your son's robe or not."
He recognized it and said, "It's my son's robe! A wild animal has devoured him. Joseph must have been torn to pieces!"
Then Jacob tore his clothes, put a simple mourning cloth around his waist, and mourned for his son for many days.
All of his sons and daughters got up to comfort him, but he refused to be comforted, telling them, "I'll go to my grave mourning for my son." And Joseph's father wept for him.
Meanwhile the Midianites had sold Joseph to the Egyptians, to Potiphar, Pharaoh's chief officer, commander of the royal guard.