Establish Connection with 3rd party system when Application server is started.

Hello Community,

I have a use case where Creatio App needs to be connected to a 3rd party system always. Please help with following questions

1. How to trigger source code that establishes the connection with the 3rd party system? Its possible to run a Business Process, but if there is any other way, it could help.

2. How to get AppConnection/ Userconnection? Since the code is not triggered from client/Business process or API service (no inheritance from BaseService), how can I get the AppConnection?

Would much appreciate your help!

Like 0



Hello Shivani, 


1. Usually such operations performing with Business Processes and script tasks and honestly we don't have much convenient options for that. 


2. Script tasks exist for this kind of operations. You may use next code to achieve your requirements: 


var userConnection = Get<UserConnection>("UserConnection");


Also please check out this link with web-services it might be useful:…


Thank you!


Bogdan L.

Thank you Bogdan. I found a post:


and it advices to get systemUserConnection as follows :

private SystemUserConnection _systemUserConnection;
private SystemUserConnection SystemUserConnection {
	get {
	     return _systemUserConnection ?? (_systemUserConnection = 


But looks like AppConnection is not a static class and I get the error in IDE as below. Please advice if I am doing something wrong or if the above suggestion does not work

In short passing the user connection from script task to call a source code or using BaseService for Web APIs is the only way to get userconection? 

Shivani Lakshman,


Please use User Connection from the script task to achieve the task desired.


Best regards,


Update : One can create a new source code schema with a class that inherits from AppEventListenerBase.
The class has UserConnection as a property.  The UserConnection can be set using methods given in the code below. The onAppStart is called everytime IIS (webserver) is restarted or after compilation. 

// Property
protected UserConnection UserConnection	{
	private set;
public override void OnAppStart(AppEventContext context) {
            UserConnection = GetUserConnection(context);
protected UserConnection GetUserConnection(AppEventContext context)    {
            var appConnection = context.Application["AppConnection"] as AppConnection;
            if (appConnection == null) {
                throw new ArgumentNullOrEmptyException("AppConnection");
            return appConnection.SystemUserConnection;


Show all comments