We've got a requirement to run some async entity event listener code, but when following the academy article for that ( https://academy.creatio.com/docs/7-18/developer/back_end_development/ob… ) and trying to use the arguments.OldEntityColumnValues property of the EntityEventAsyncOperationArgs arguments parameter passed in, we get the following compilation error which we cannot seem to resolve:

 

From looking online for general resolutions, it looks like we maybe need to add this assembly to the web.config file, but we're on a cloud instance so presume this isn't a feasible resolution.

 

Any advice would be greatly appreciated.

 

Reduced version of the code (without usings etc shown) that throws the error below:

public class UsrAsyncSendLeadAssociation: IEntityEventAsyncOperation
{
    public void Execute(UserConnection userConnection, EntityEventAsyncOperationArgs arguments) {
        var oldModVal = arguments.OldEntityColumnValues;
    }
}

 

Like 0

Like

1 comments

Hello,

As a quick solution, you should disable the option "Compile into a separate assembly" in the package where the schema is located.

After this, the problem should be resolved.

Show all comments

Hello,

 

I am willing to add a process for validation on Save for the Case object as shown in figure attached.

 

Any insights please?

 

Thanks,

Like 0

Like

1 comments

Hello,

 

The following instructions can help you to achieve the result you are looking for: validators schema section

 

Show all comments

I am using the BaseEntityEventListener.OnSaving method where in addition to saving the entity I want to call an asynchronous method. Is there any way I can convert OnSaving to asynchronous?

Like 0

Like

1 comments

Hello,



Unfortunately, it could be achieved only via Asynchronous operations in the Entity event layer described by the link below:

https://academy.creatio.com/docs/developer/back_end_development/objects…

 

Best regards,

Bogdan

Show all comments

Hello,

I am trying to validate a record before it gets inserted into the DB using entity events layer :  public override void OnInserting(object sender, EntityBeforeEventArgs e);

 

If the validation fails, I would like to display a message to the user. Is there a built in method like set validation message or something? I understand this can be done through Web socket but I would prefer if I am able to use a built in validator.

 

Thanks

Like 0

Like

2 comments
Best reply

Hello Shivani,

You can simply throw an exception from the event and it will halt the insert process and display the exception message to the user.

An an example, this OnInserting event checks to ensure the Also known as field is not empty:

using System;
using Terrasoft.Core.Entities;
using Terrasoft.Core.Entities.Events;
 
namespace FX.EntityEventListeners
{
    [EntityEventListener(SchemaName = "Account")]
    public class UsrAccountEntityEvents : BaseEntityEventListener
    {
        public override void OnInserting(object sender, EntityBeforeEventArgs e)
        {
            base.OnInserting(sender, e);
            var account = (Entity)sender;
 
            if (string.IsNullOrEmpty(account.GetTypedColumnValue<string>("AlternativeName"))) 
            {
                throw new Exception("Also known as cannot be blank");
            }
        }
    }
}

This displays this message when the user inserts an account without this field populated:

Ryan

Hello Shivani,

You can simply throw an exception from the event and it will halt the insert process and display the exception message to the user.

An an example, this OnInserting event checks to ensure the Also known as field is not empty:

using System;
using Terrasoft.Core.Entities;
using Terrasoft.Core.Entities.Events;
 
namespace FX.EntityEventListeners
{
    [EntityEventListener(SchemaName = "Account")]
    public class UsrAccountEntityEvents : BaseEntityEventListener
    {
        public override void OnInserting(object sender, EntityBeforeEventArgs e)
        {
            base.OnInserting(sender, e);
            var account = (Entity)sender;
 
            if (string.IsNullOrEmpty(account.GetTypedColumnValue<string>("AlternativeName"))) 
            {
                throw new Exception("Also known as cannot be blank");
            }
        }
    }
}

This displays this message when the user inserts an account without this field populated:

Ryan

 

Thanks Ryan! This works!

Show all comments

Hello Community,

 

Lets say, I have a Business process which is triggered when an Email Template record is modified, and that Email template is updated via a Package installation, the logical expectation is that the 'Modified' event is triggered and the Business process runs. We however notice that the event is not triggered, and the business process does not run.

  1. Do Package installations and changes through that trigger entity events? Do Package installations effect object changes to the DB via the ORM or does that mechanism work differently?
  2. If I wrote a business process which had a trigger to the SysPackage object and looked for modifications to a specific package, will it get triggered when I install that package??
Like 0

Like

2 comments

Hello, 

 

Our application doesn't support designing business processes that are triggered after modifying system objects. The core of business process mechanisms works on low-level API which doesn't support start signals functionality. This is done in order to avoid any kind of accidents with business process mechanisms and also for performance maintaining reasons.

 

Best regards, 

Anastasiia 

Anastasiia Zhuravel, Thanks Anastasiia,



I am not sure I understood this - "The core of business process mechanisms works on low-level API which doesn't support start signals functionality". Are you saying that the start signal functionality does not work in Business processes?

Show all comments

Hello Community,

 

The Entity event layer is a powerful tool to listen to changes to schemas on the server side and perform actions based on them. The documentation states the following - 

The Entity event layer mechanism is triggered after executing the event subprocesses of an object.

 

Few questions below - 

  1. Are entity events triggered for all system schemas & custom schemas? We know it works with Custom schemas, but we have had a few instances where it did not get triggered for system schemas Eg 'System administration object' or 'Image' object. We also notice that a business process with Start signal tied to the "System administration object" or 'Image" object also doesn't work. 
  2.  Are there any restrictions around which schemas/objects or kinds of changes, these entity events will get triggered for?
  3. Are the entity layer events triggered on the server exactly the same as the 'Signal' start events that we configure in the Business process designer?
Like 2

Like

5 comments
Best reply

Dear Shrikanth,

 

1.  It is triggered for all entity objects present in the configuration section.

 

2. It gets triggered by any CRUD operations performed using DataServevice (Entity and EntitySchemaQuery), OData, and OOTB business process elements. It will not get triggered if data is changed using Insert, Update, Delete classes, and if data is changed directly on the DB level.

 

3. It works the same as the Event subprocess https://academy.creatio.com/documents/technic-bpms/7-16/event-sub-process-element

 

Best regards,

Angela

Dear Shrikanth,

 

1.  It is triggered for all entity objects present in the configuration section.

 

2. It gets triggered by any CRUD operations performed using DataServevice (Entity and EntitySchemaQuery), OData, and OOTB business process elements. It will not get triggered if data is changed using Insert, Update, Delete classes, and if data is changed directly on the DB level.

 

3. It works the same as the Event subprocess https://academy.creatio.com/documents/technic-bpms/7-16/event-sub-process-element

 

Best regards,

Angela

Angela Reyes,

Thank you Angela for your clear responses.



I am presuming that there are no special settings to be done to enabled for them to be triggered on System objects. Hence, our errors are not the expected behavior is what I understand.

Angela Reyes,

Hi Angela. Quick follow up question - 



1. Do entity events get triggered for virtual objects & views as well? Virtual objects are also objects displayed in Configuration. So going by your explanation, It should. Can you confirm?

2. Are entity events listenable on the Client side? I do not think so. Can you confirm?

M Shrikanth,

1) I have not checked it - try to create a test process and check it. 

2) If you set up sending of an event it can be done. 

 

Best regards,

Angela

Arsenii Pelekh,

Hello,

 

You can find information on this subject here:

https://academy.creatio.com/docs/developer/back_end_development/objects…

Show all comments