I had only partial colectomy, but I get horrible cramping and gas before my stoma "produces" too. If I can get to a bathroom I can "do" it right in the pot, which I prefer because it's less cleanup in my case.
My trigger is foods like grapes, grape juice and wine, also milk with lactose left in. I am lactose intolerant. I ate a small Frosty today and 20 minutes later ran to a restroom.
As with some GERD and migraine people, keeping a good food journal - foods, drinks, medicines, time, day, and reactions - helps identify my triggers. I got started on this on advice from my allergist because my gastric reflux goes on to trigger tachycardia.
After identifying my food list, I had to break down the foods into ingredients and do "challenge testing." I've described this in posts you can find by putting the keywords into the search box at the top of the page.