Getting past the immediate trigger works wonders for me. If sweets are brought in to work I'll think I'll come back and get mine in a little bit, usually I'll get distracted by something else and/or the stuff will be gone or not as appealing as that first glance.
Trying to be more mindful all around, enjoying the moment I'm in, the salad I had for lunch yesterday was delish, looking forward to some delicious roasted veggies for supper tonight. Paying attention to the moment I'm in has made most things, including food, more enjoyable, didn't try it at the dentist the other day, that was more about trying to imagine I was somewhere else
Best to all