Update rule when changing action name

Adding this script will automatically update the database at the appropriate location so one doesn’t need to go and manually re-add an action to a rule in the event of an action name change.

Execute this script inside your favourite IDE (like SQL Server Management Studio)
Make sure that SambaPOS5 in USE SambaPOS5 is your correct database.

/* Update ActionContainers on Action Name Change */


IF OBJECT_ID('dbo.trg_app_actions_update') IS NOT NULL
  DROP TRIGGER dbo.trg_app_actions_update;

CREATE TRIGGER trg_app_actions_update
  ON AppActions
    DECLARE @ActionID   INT
    DECLARE @ActionName NVARCHAR(50)

    SELECT @ActionName  = Name FROM INSERTED;

    UPDATE ActionContainers
    SET Name = @ActionName
    WHERE AppActionId = @ActionID;

Or, unzip the following file place the script in %USERPROFILE%\Documents\SambaPOS5\Database Tasks (unless installed in a location other than default).

[CBL]auto_trg_update_action_containers.zip (489 Bytes)

Go to Management -> Settings -> Database Tools and select auto_trg_update_action_containers.sql then select “Execute Task”.

There will be an automatic backup.

Now when changing an action name instead of seeing things like this:


you’ll see no popups or this after testing rules:


1 Like

This is an exact reason I like to use generic actions, just reuse and forget.

I did for the stuff early on. There’s some mods I’ve done that I’d like to be able to export for use on another install, possibly, in the future. I wasn’t planning prefixes when I started. I ran into having to re-add actions and thought, “there has to be an easier way”. Now, I don’t have to think about it.


Yeah I do the same and agree. I used to do like JTR mentioned by reusing actions, but it makes it complicated for reusing on different setups. So now I make sure all use unique (sometimes duplicated) actions and export together, then I can easily import to any new setup and should work without any change.

The only downside is you end up with multiple actions doing the same thing, but I haven’t noticed it makes any difference regarding performance.

1 Like