How to execute an Installshield Custom action while Rollback? - installshield

I have an InstallShield installer which does some stuff. In case the installation breaks the rollback sequence gets started. I do know that I can create conditions for my custom actions in order to make it run only during install or uninstall, but which condition do I set to make it run on rollback?
To be precisely I need rollback and remove. At the moment I have already set REMOVE which works perfectly on uninstall.

Rollback is not detected through conditions. Instead set the in-script execution of the custom action to one of the rollback options. This action will then run only during a rollback that occurs after the sequence at which it was scheduled, and only if its condition was true at that point in the sequence.

Related

Python Pywinauto detect window based on existence of certain class_name

Background:
I am trying to automate an installer that will be distributed to a bunch of different computers. Some of these already have a MS distributable file, some of them don't. The ones without this file have this inside the window control identifiers:
child_window(class_name="SysHeader32")
The reason this is important is that this will be an extra step in the installation that needs to have a button pressed. Is there a way to make an if loop similar to:
if main_dlg.child_window(class_name="SysHeader32") exists:
click install
proceed normally
else:
Proceed normally
How would I implement this?
I have it working without the extra step, but if this extra step is present, the install fails.
There is method .exists(timeout=5) which returns True/False instead of raising exception like other methods do. Of course, try-except block is also possible, but .exists() looks better as a logic than an error handling.
BTW, else branch is not needed. Just proceed normally after the condition code is executed or not.

How do you rollback updates with jdbcRowSet?

I can use acceptChanges, jdbcRowSet1.acceptChanges(); , with my jdbcRowSet data source to accept the changes (updates, deletes, etc). How would I rollback or cancel any updates, deletions, etc.???
I tried jdbcRowSet1.rollback(); but got an error.
Error while executing JavaScript action expression
Script interpreter error, line=1, col=13: Unknown member 'rollback' in Java class 'com.ibm.xsp.extlib.jdbc.model.JdbcRowSetAccessor'
JavaScript code
1: jdbcRowSet1.rollback();
Anyone try this yet?
thanks, Howard
The jdbcRowSet data source does not currently support rollback(). We could add support for this in the future perhaps (no guarantees). From my reading, there is a method RowSet.cancelRowUpdates() that we could use in our jdbcRowSet implementation for this, but it only cancels updates to a row, and doesn't cancel deletions/insertions.
A simple potential solution for your issue would be to reload the page via javascript call, context.reloadPage(), and that will discard the current rowSet. Simplistic solution, but it may do the trick for you.
Your questions is really less XPages specific, and more about general SQL management in Java, so if you want a more indepth answer than I provide, you may want to update your tags.
More than likely your connection has autocommit set to true. This forces the data set to commit changes as you make them immediately, so there is nothing to roll back. The rollback() method is from the connection object related to the row set, and will not provide a rollback when autocommit is true, hence the error you get.
You need to look into changing your auto commit to false, then make sure you call commit() or rollback() when you are done with your changes. If you have multiple transactions occurring, you should look into the the connection manager as well. I touch in this briefly in the chapter on the SQL controls in the Extension Library book from IBM Press.

Does Deactivate/Reactivate of a SharePoint Feature Increment the Version?

We have a complex scenario which requires a timer job to run after content deployment to a SP 2010 site collection. The timer job automatically deactivates/reactivates a branding feature which is responsible for setting the master page for the site collection, among other things.
We have had several feature upgrades along the way, and neglected to call .Update() on the feature in that specific site collection. So all of the updated CSS, master page, page layouts etc. are out of date on that SC.
The strange part is that when I checked the version number of that feature in this SC, it shows as the latest version. The custom upgrade action clearly didn't run and update the files, because nobody called .Upgrade().
One of my colleagues suggested that the deactivate/reactivate process done by the timer job would update the version number, meaning that I can no longer call Upgrade()!
Is that true? Does a deactivate/reactivate cycle for a feature automatically update the feature version number?
Is there an easy way to fix this mess? Some way to decrement the version number programmatically, then call Upgrade()??
On 1: No. Feature deactivating / activating does not trigger an update. See this article by Chris O' Brian: http://www.sharepointnutsandbolts.com/2010/06/feature-upgrade-part-1-fundamentals.html
Feature upgrade does NOT happen automatically (including when the
Feature is deactivated/reactivated)! The only way to upgrade a Feature
is to call SPFeature.Upgrade(), typically in conjunction with one of
the QueryFeatures() methods. My tool which I’ll go on to talk about is
a custom application page which helps you with this part – note there
is no STSADM command, PowerShell cmdlet or user interface to do this
out-of-the-box.
Is your timer job cycling the feature activation with Force? Then, yes, it is triggering the feature upgrade/feature update see the following screenshot from SPFeature.Activate (see my yellow marking):
Why the feature version is incremented, I'm not sure. When you have a feature, install a new feature version and activate / deactivate, the feature version stays the same unless you run an Upgrade, see also this related question stating the same: https://sharepoint.stackexchange.com/questions/41476/feature-upgrading-question
I'm guessing your timer job is using force? Otherwise I'm not quite sure what is happening.
On 2: Don't know if it is possible to decrease the version number, but the safest way would be to just create a new version including a grand "clean up" feature receiver which sets everything correct, i.e. checks which steps of the feature upgrade have happened already (e.g. new list created, new content type added) and which haven't. Depending on that just execute the same steps again which have not executed yet. For the latter part you can fortunately use the existing code, so you would only need the "clean up" or checking code.
After some testing I found that simply deactivating and reactivating the feature will increment the version number and completely screw up your upgrade! I even watched the update come through in the content database. As soon as you deactivate/reactivate the updated feature, the new version number pops into the content DB. Of course the upgrade doesn't actually run, it just increments the version number.
This means that if you then call .Upgrade() it won't work because SharePoint thinks it's already been upgraded!!
To fix this I updated the row in the content database to set the feature version back to 0.0.0.0 for that particular web and then I could run .Upgrade() just fine....but that's not exactly a supported solution. If anyone else has a better idea drop a reply.

Install Shield, How to check the exit code but not show error?

I have a custom action that runs in the very beginning of my Install Shield Project.
I check the exit code on this custom action because it is a form that has a next and cancel button, if the user cancels the install should NOT proceed, if they select next it should (thus I check the exit code). However I don't want the user to see an install-Shield error message when they select cancel.
Is there anything I can do?
I have install shield 2010
EXE custom actions can only succeed or fail (zero or non-zero return code). MSI DLL custom actions can set properties (that future actions can condition on), and return one of several status indicators including success, failure, or user cancelled. If you have to use an EXE (say because it was provided to you), you will likely need to wrap it in a MSI DLL custom action to do what you want. Or, if possible, it may be a lot better to rewrite the EXE as a DLL.

stopping sharepoint workflow programmatically

well the thing is i am having a scheduled script that checks some changes in a different database (Oracle), if the change happens
I need to cancel /kill/ stop a workflow if it is in progress on a specific item of my list
How to do that?
I did not try, but the SPWorkflowManager.CancelWorkflow Method should do what you want to do: "Cancels the specified workflow instance."
I hope it works and solves your problem.

Resources