Question

Install Script only runs on clean install, not on update – how to fix?

I can’t get the Install Script to run during an application update.
The Install Script only runs on a fresh install. If I increase the application version and install it via file upload, the Install Script doesn’t run.
How can I make the code run both on installation and on application update?

 

 

Like 0

Like

4 comments

Hello,

Just to make sure we're aligned — when you mention the Install Script, are you referring to a custom script that you've added to run during the application's installation process?

Could you also let me know what exactly this script is doing?

At the moment, the question isn’t fully clear on our side, so a bit more context would really help us understand what you're trying to achieve.

Hello, 
Yes, this is an Install Script created according to the instructions from https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/development-tools/delivery/customize-delivery-process/overview.

We need this script for add data to SysCspUserTrustedSrc and SysCspUsrSrcInDirectv.

The Bind CSP setting mechanism described here: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/security-settings/content-security-policy#title-2501-4 has an issue: if a client has already added our domain to SysCspUserTrustedSrc, then during installation/update of the application an error occurs:

2025-08-28 12:50:35,920 Error occurred while installing data "SysCspUserTrustedSrc" in package "*****".  
UId 346161e1-2f08-e755-0601-13011b72bd76: 23505: duplicate key value violates unique constraint "SourceUniqueIndex"  
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.  
INSERT INTO "public"."SysCspUserTrustedSrc"
("Id", "CreatedOn", "CreatedById", "ModifiedOn", "ModifiedById", "Source", "Active", "Verified", "Description")  
VALUES('{22574740-CEC6-4054-ABB1-83FA36839479}', TO_TIMESTAMP('2025-08-28 12:50:35.905', 'YYYY-MM-DD HH24:MI:SS.FF3'), '{410006E1-CA4E-4502-A9EC-E54D922D2C00}', TO_TIMESTAMP('2025-08-28 12:50:35.905', 'YYYY-MM-DD HH24:MI:SS.FF3'), '{410006E1-CA4E-4502-A9EC-E54D922D2C00}', '*****', true, true, '')  
2025-08-28 12:50:35,934 Terrasoft.Common.DbOperationException: 23505: duplicate key value violates unique constraint "SourceUniqueIndex"


Therefore, we planned to use the Install Script to check for existing records in SysCspUserTrustedSrc and SysCspUsrSrcInDirectv and add the missing ones, avoiding errors.

But we ran into a problem: the script only runs on the first installation of the application. During installation of new versions, the script does not run.

Currently, we decided to use Bind CSP setting and notify clients to remove previously added SysCspUserTrustedSrc and SysCspUsrSrcInDirectv entries in order to avoid errors.
 

Hello,

I’d like to clarify the behavior you’ve observed. This is expected and consistent with how our system is designed. Installation scripts are not executed automatically during updates, as they may introduce significant changes to your system. Running them automatically could lead to unpredictable or undesired behavior.

To avoid this and give you full control, we recommend manually triggering the required scripts after each update. You can do this through the application configuration by selecting the necessary scripts, opening the Action menu, and clicking the Install Data button.

For your convenience, I’ve attached a screenshot illustrating where and how to perform this action.

Anastasiia Zhmud,

Thank you for your response

Show all comments