How can I programatically click the Cancel button
Posted:
Fri Aug 01, 2014 5:05 pm
by indikad
say the Service Manager - Jobs window.
for example - when a user starts a new job - given a condition - I want to alert user that this job cannot be saved and programatically hit he Cancel button.
Re: How can I programatically click the Cancel button
Posted:
Sat Aug 02, 2014 12:26 pm
by Mike.Sheen
Hi Indika,
It'd be better to just call the business logic's Read method, using the RecID of the current job - that will cause the UI to respond as if the cancel button was pressed.
You *can* press the cancel button using code, but it's better if you don't - you never know what other plugins or whatever are doing - for example if there is a modal dialog currently open then the tool click on the ribbon might not have any effect (I've not tested this, I'm just imagining there will be circumstances where a UI simulated action won't always work).
Let me know if calling the business logic Read method doesn't work for you, and I'll invest some more time myself and come up with a solution.
Mike
Re: How can I programatically click the Cancel button
Posted:
Mon Aug 04, 2014 11:55 am
by indikad
calling the read method worked ( on Job.CreateStart ) this is what I need to.
Thanks Mike.