Hello everybody

I'm working in file-system mode in a 7.18.5 development environment.

I need to override the OnSaving method of the Account entity then I created a custom EntityEventListener (following Creatio documentation).

I followed all the instructions of Creatio documentation  to setup my Visual Studio 2019 Enterprise and my local Creatio web application (see https://academy.creatio.com/docs/sites/en/files/pdf/guide/191/Debugging_7.18.pdf).

I worked both on "Compile into a separate assembly" package (in this case opening the package project file) and "traditional" package (in this case using the autogenerated Terrasoft.Configuration.sln solution).

When I attach to w3svc process my VS2019 (run as administrator) the breakpoints are not recognized because the symbols are not loaded. Then I force to load symbols so the breakpoints are recognized (see image below):

 

If I add a new break point during debug there's an error:

 

Anyway.. the debugging doesn't work: if I press F10 or F5 the breakpoints after the first are not manged and the execution ends.

 

So we have two main problems:

1) The symbols are not automatically loaded (but I can do it manually..)

2) The debugging tools dont work

 

I'm I doing something wrong?

I can I really debug server-side code?

Thanks

 

Like 0

Like

4 comments

Hello Massimiliano,

 

As for the automated symbols download - yes, please download them manually in case automated download didn't download all the symbols.

 

As for the breakpoint set - unfortunately there is no standard solution for this, only those described in forums here or here.

 

Best regards,

Oscar

Oscar Dylan,

Hello Oscar,

It seems related to the "Optimize code" option but it seems to me that Creatio compiles the packages in Release mode and not in Debug mode. Does the issue comes from that? Is there any solutions?

Thakns

Best regards

Massimiliano

Massimiliano,

 

<compilation debug="true" targetFramework="4.7">
        <assemblies>
          <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </assemblies>
      </compilation>

 

and all other settings performed in terms of the article you sent should compile packages in debug mode.

 

Best regards,

Oscar

Dear Oscar

I tried to change that setting in both web.config files (the "root one" and the "Terrasoft.WebApp one") but it didn't work. I saw that the dll's are compiled into the "Release" folder and not into "Debug" folder.

Am I doing something wrong?

If we set "debug=true" in the web.config files, are the packages created correctly to be deployed to production environments or do we need to reset the "debud=false" and recompile before exporting the packages?

Best regards

Massimiliano

Show all comments

Hi Community,

 

What is the syntax for EntitySchemaQuery createColumnIsNotNullFilter in server side code?

 

Thanks

Like 0

Like

1 comments

Hello,

 

Here is the example.

function OwnerFilter() {
		return Terrasoft.createColumnIsNotNullFilter('[SysAdminUnit:Contact].Id');
	}

You can also find example it in BaseFiltersGenerateModule of NUI package.

 

Regards,

Dean

 

Show all comments

Hello community,

 

We have a use case where some business logic has been implemented as a business process and the output of it is set to 2 business process parameters. We need to trigger this BP from source code and read the output parameters after execution of the process. The execution part is straight forward. The reading of parameters is not. 

 

I went through various articles/questions on the community related to these. But most of them only talk about executing a process by setting parameters and not reading parameters after execution. Request some assistance.

I also went through the IProcessExecutor documentation here and it permits to retrieve one result parameter. What if I need to read more than 1 parameter at the end of the business process execution?? Is there any other way to execute a BP from server side code and get the output parameter?

Note - I am aware that the Business process can be executed via a Http call to the ProcessEngineService and output parameters retrieved via the ResultParameterName query parameter. This is not a viable option for us. Additionally, it only permits one ResultParameterName and not reading multiple business process parameters.

Like 0

Like

2 comments
Best reply

Hello,

 

You can use this example to receive parameters: 

// getting UserConnectionUserConnection userConnection = GetUserConnection();
// getting  IProcessExecutor
IProcessExecutor processExecutor = userConnection.ProcessEngine.ProcessExecutor;
// List of input parameters
var inputParameters = new Dictionary&lt;string, string&gt; {
    ["ProcessSchemaParameter1"] = "Value1",
    ["ProcessSchemaParameter2"] = "Value2"
};
//  List of output parameters
var resultParameterNames = new string[] {
    "ProcessSchemaParameter3",
    "ProcessSchemaParameter4"
};
string processSchemaName = "processSchemaName";
Guid processSchemaUId = Guid.Parse("00000000-0000-0000-0000-000000000000");
 
// Run the process by schema name and forwarding output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, resultParameterNames);
// Run the process by schema UId and forwarding output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaUId, resultParameterNames);
 
//  Run the process by schema name with forwarding input and output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, inputParameters, resultParameterNames);
// Run the process by schema UId with forwarding input and output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaUId, inputParameters, resultParameterNames);

You can also get values of the resulting parameters by accessing the ResultParameterValues property of the IReadOnlyDictionary <string, object> type of the ProcessDescriptor class: 

ProcessDescriptor processDescriptor = processExecutor.Execute("processSchemaName", inputParameters, resultParameterNames);
object parameter3Value = processDescriptor.ResultParameterValues["ProcessSchemaParameter3"];
if (processDescriptor.ResultParameterValues.TryGetValue("ProcessSchemaParameter4", out object parameter4value)) {
    Console.Log(parameter4value);
}

Please note that such process will always be run in not-background mode and you will be able to receive several parameters only from version 7.17.1. 

 

Best regards,
Angela

Hello,

 

You can use this example to receive parameters: 

// getting UserConnectionUserConnection userConnection = GetUserConnection();
// getting  IProcessExecutor
IProcessExecutor processExecutor = userConnection.ProcessEngine.ProcessExecutor;
// List of input parameters
var inputParameters = new Dictionary&lt;string, string&gt; {
    ["ProcessSchemaParameter1"] = "Value1",
    ["ProcessSchemaParameter2"] = "Value2"
};
//  List of output parameters
var resultParameterNames = new string[] {
    "ProcessSchemaParameter3",
    "ProcessSchemaParameter4"
};
string processSchemaName = "processSchemaName";
Guid processSchemaUId = Guid.Parse("00000000-0000-0000-0000-000000000000");
 
// Run the process by schema name and forwarding output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, resultParameterNames);
// Run the process by schema UId and forwarding output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaUId, resultParameterNames);
 
//  Run the process by schema name with forwarding input and output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, inputParameters, resultParameterNames);
// Run the process by schema UId with forwarding input and output parameters
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaUId, inputParameters, resultParameterNames);

You can also get values of the resulting parameters by accessing the ResultParameterValues property of the IReadOnlyDictionary <string, object> type of the ProcessDescriptor class: 

ProcessDescriptor processDescriptor = processExecutor.Execute("processSchemaName", inputParameters, resultParameterNames);
object parameter3Value = processDescriptor.ResultParameterValues["ProcessSchemaParameter3"];
if (processDescriptor.ResultParameterValues.TryGetValue("ProcessSchemaParameter4", out object parameter4value)) {
    Console.Log(parameter4value);
}

Please note that such process will always be run in not-background mode and you will be able to receive several parameters only from version 7.17.1. 

 

Best regards,
Angela

Angela Reyes,

Thank you Angela for the inputs

Show all comments

Dear community,

I have a task: Show a confirmation dialog with OK and KO buttons to confirm Case cancelling if the user clicked on the Cancel status in DCM.

If the OK button, then the case will be cancelled.

If the KO button, then the case will return to the previous status.

 

I have tried to display a dialog box on the OnSaving event of the Case object.

Here is my function:

public override void OnSaving(object sender, EntityBeforeEventArgs e) {  
     string status = UpdateData(sender);
     if(status!="Canceled") {
                base.OnSaving(sender, e);
     } else {
    		//Todo: Show dialog with question
  		//Todo: Get response OK or KO
                /*if(response ="OK"){
                        base.OnSaving(sender, e);
                }else{
                        e.IsCanceled = true;
                }*/
     }
}

 

Unfortunately, I have not found any information on how to display the dialog box on the server side.

I know the method of sending messages from the client side (this.showConfirmationDialog(message, function(returnCode )), but I don't know how to return the result of the pressed button to the server to complete the OnSaving method.

private void SendMessage(object sender) {
      var entity = (Entity)sender; 
      var userConnection = entity.UserConnection;
      string senderName = "MySenderNameCase";  
      string message = JsonConvert.SerializeObject(new {test = "status"});
      MsgChannelUtilities.PostMessage(userConnection, senderName, message);
  }             

 

Please help me to implement this task.

Thank you in advance.

Best regards,

Mariia

Like 0

Like

3 comments

Dear Mariia,

 

You can just add validation on the page instead: 

methods: {
...
asyncValidate: function(callback, scope) {
    this.callParent([function(result) {
        if (!this.validateResponse(result)) {
            return;
        }
        this.Terrasoft.chain(
                this.validateUserConsent(function() {
                    next();
                }, scope);
            },
            function(next) {
                callback.call(scope, result);
                next();
            },
            this
        );
    }, this]);
},
validateUserConsent: function(callback, scope) {   
    //Show confiration dialog with this.showConfirmationDialog
    //If yes - this.Ext.callback(callback, scope || this);
    //If no - return;
}

Best regards,
Angela

Dear Angela Reyes,

 

Thank you for your reply.

But is does not work correctly for me, maybe because of mandatory activities in DCM.
I need all activities to be cancelled, in the case of switching to the Canceled stage.
How to perform such a task?
Thank you.

 

Best regards,

Mariia

Mariia Prostiak,

 

Hello,

 

But all the activities of the current stage are being canceled in case they were not completed and the stage is changed to the next one. Can you please specify why do you need to override this logic?

 

Best regards,

Oscar

Show all comments

Dear Community,

 

I am trying to copy values from a field and lookups to put it in the "Name" fields before saving.
I use the following code in the script task but I don't know how to get the value from a lookup:
Entity.Name = $"{Entity.Code } - {Entity.Description}";
Code being the lookup.

So if you create a record in a lookup it would go like this:
[Name][Code][Description]

[           ][ 001 ][Code for info]

The Name should automatically be filled with "001 - Code for info" after saving.
What is the correct way to set the script?

Thank you!

 

 

Kind regards,

Yosef
 

Like 0

Like

2 comments

Hi!

 

Just add on saving event in your lookup entity, and add a script

 

Entity.SetColumnValue("Name", string.Format("[{0}][{1}]", Entity.GetTypedColumnValue&lt;string&gt;("Code"), Entity.GetTypedColumnValue&lt;string&gt;("Descritpion"));

 

Dmytro Oliinyk,

 

 

Thank you but that didn't seem to work for me, this was the solution for me:

 

var name = Entity.GetColumnValue("Name");
var description = Entity.GetColumnValue("Description");
 
var esq = new EntitySchemaQuery(Entity.Schema);
esq.AddColumn("Code.Name");
 
var CodeEntity= esq. GetEntity(UserConnection, Entity.PrimaryColumnValue);
if (CodeEntity != null) {
 
	var columnUsrCodeName = CodeEntity .GetTypedColumnValue&lt;string&gt;("Code_Name");
 
	string fullName= $"{name}: {columnUsrCodeName } - {description}";
	Entity.SetColumnValue("Name", fullName);
}
return true;

Let me know if there's an easier way to do this.

 

 

Kind regards,

Yosef

Show all comments

Hi

I'm developing an anonymous web service based on this tutorial:
https://academy.creatio.com/documents/technic-sdk/7-16/creating-anonymo…

I want to get the full raw request body inside a POST method.

Is there any way to do it since it's not supported in WCF?

Or can I create a web service based on .NET Web API instead of WCF Rest API?

 

Thank you

Mohamed

Like 0

Like

5 comments

Hi Mohamed, 

 

Could you please specify your business target and which task should it solve? Please provide a bit more detailed information on your task and its purpose. Look forward to hearing from you!

 

Regards, 

Anastasiia

Anastasiia Markina,

 

I'm building an endpoint to receive Webhook notifications.

In order to verify the sender identity, I should validate the message signature with HMAC-SHA256 secret key.

To do that, I should get the full request body and create a digest then compare it with the signature.

 

Thank you

Mohamed

 

Mohamed,

 

Can you please also specify if you are going to create a web-service through the internal system resources like a custom package or you want to use outside .NET environment and connect such a web-service to your Creatio platform? 

 

Regards,

Anastasiia

Anastasiia Markina,

 

I'm creating a creatio configuration service that will use ESQ to read/add data.
Hope that explains the situation.

 

Thank you

Mohamed

Mohamed,

 

Thank you for the clarification.

 

To receive the original POST request, you need to inherit your web-service from the base class BaseService and get the request through the BaseService.IHttpContextAccessor.GetInstance().Request.

 

However, please note that this is not the original method but the Creatio's system wrapper. You can find the example in the configuration section, "EsnService" module, ESN package.

 

Regards,

Anastasiia

Show all comments

How to apply access permissions (object permission) / access right when insert data via server-side?

I have set the record access permission, but when inserting via server-side, the access right does not work. The insert method that I did was in accordance with the article above.

Thanks.

Like 0

Like

1 comments

Hi,

It is possible adding data via server-side with access permissions using the “Entity” class. Please find more information with the examples by the link below:

https://academy.bpmonline.com/documents/technic-sdk/7-13/working-database-entity-class

Best regards,

Norton  

Show all comments