Dear colleagues,

 

I have a problem when deleting records in a detail, when the deletion is one by one we can manage it, but when the user selects several records and deletes them, the deleted record trigger is not activated.

 

  1. How can this kind of massive deletion event be detected?
  2. Is it possible to remove from the detail menu the option to select multiple records?

 

Thanks in advance

Like 1

Like

4 comments
Best reply

Julio.Falcon_Nodos,


Hello,
 

The button is added in the addGridOperationsMenuItems method of the BaseGridDetailV2 schema, depending on the value of getSwitchGridModeMenuItem.


To remove the button, simply override this method in the desired detail with the following value:


methods: {
   getSwitchGridModeMenuItem: function() {
       return false;
   },
}
 





However, it’s important to note that removing the button does not disable the ability to select multiple records, for example, using the "Ctrl + Click" combination. Unfortunately, disabling multi-selection entirely is not possible for Classic UI details.

Best regards,
Pavlo

Hello,
 

Creatio does not have a separate event for multi-delete event; each delete operation will be processed separately.
 

I was unable to reproduce the behavior where logic tied to the deletion event of records fails to execute in case of multi deletion.

 Could you please provide more details about your mechanism's configuration?
 

Regarding the possibility of removing multi-select in a detail, in Freedom UI, you can configure this in the page designer by unchecking the "Multiselect" parameter. 


Unfortunately, this is not possible in Classic UI.
 

Best regards,
Pavlo!

Pavlo Sokil,

Thanks Pablo, of course is for a classic ui detail..

 

I think it's possible to solve, you can see some approach on the last comment in the article on https://community.creatio.com/questions/hide-delete-button-condition

 

The problem is there not enough documentation, but I think I'm on right way, at this time didn't know how to continue to hide, from the detail menu, the select all records option.

 

Regarding to detect, in a process a massive delete, no idea if it's possible :-(

Julio.Falcon_Nodos,


Hello,
 

The button is added in the addGridOperationsMenuItems method of the BaseGridDetailV2 schema, depending on the value of getSwitchGridModeMenuItem.


To remove the button, simply override this method in the desired detail with the following value:


methods: {
   getSwitchGridModeMenuItem: function() {
       return false;
   },
}
 





However, it’s important to note that removing the button does not disable the ability to select multiple records, for example, using the "Ctrl + Click" combination. Unfortunately, disabling multi-selection entirely is not possible for Classic UI details.

Best regards,
Pavlo

Thanks Pavlo! it works

Show all comments

Hi Community,

Can you provide a code snippet of how we can capture the delete event generated from an Editable List, from the parent Page?

Example:

 

We want to catch in the Opportunities_FormPage -> the deletion of a record in Opportunity Team Detail.

Regards,

Sasor

Like 0

Like

3 comments

Hi Community,

Any update regarding this scenario?

Sasori

Sasori,

You can fetch the event of deletion in a business process. Then you can do actions and if your object opportunity has live update set then the updates will appear as soon the business process has run.

 

Other option would be to add your own action in the list and handle all necessary changes in the page.

 

Franck

Hello!

There is a crt.DeleteRecordsRequest, you can add a custom handler for this request (handlers in schema metadata).

This request is called when the user tries to delete records from the row menu and bulk actions menu.
But it is called before user confirmation (modal window), and rights checking.

There are such properties in the payload: 

dataSourceName - data source name of list, for which request is called;
filters - filters for records deletion(passed when records deleted by bulk actions panel)

recordIds - record ids which should be deleted (passed when record deleted by clicking row menu delete button)

Example:


handlers: /**SCHEMA_HANDLERS*/[{
            request: "crt.DeleteRecordsRequest",
            handler: async (request, next) => {
                const dataSourceName = request.dataSourceName;
                const filters = request.filters;
                const recordIds = request.recordIds ;


                console.log(dataSourceName, filters, recordIds );
                return next?.handle(request);
            }
}]/**SCHEMA_HANDLERS*/,

Show all comments

In the academy documentation, there is limited information about using the ESQ/ORM server-side methods to delete data, with only 2 or 3 toy examples. We need to efficiently delete large volumes of data using server-side ESQ in one of our processes, but we can't see anything about bulk deleting while still firing off any event-based triggers on the entity or generating change log records for it. Obviously the direct Terrasoft.Core.DB delete statement would be very efficient, but would skip the Creatio logic where needed.

 

We've been able to delete records by iterating over a collection of entities matching the required filtering condition retrieved by using GetEntityCollection and then for each entity in the collection, running a FetchFromDB on its Id before deleting it, but this seems like quite a few steps more than should be required and doesn't do it in a batched way.

 

Any help would be greatly appreciated.

Like 0

Like

2 comments

Hello Harvey,

 

You can use out-of-the-box examples of bulk deletion logic. For example we can take the BulkEmailTargetArchiver class and the DeleteArchiveLevel method in it:

private void DeleteArchiveLevel(string sourceSchemaName, string targetSchemaName) {
			int processedRecords;
			do {
				var deleteQuery = new Delete(_userConnection).From(sourceSchemaName)
					.Where("Id").In(new Select(_userConnection)
						.Top(_batchSize)
						.Column("s", "Id")
						.From(sourceSchemaName).As("s")
						.Where().Exists(new Select(_userConnection)
							.Column(Column.Parameter(1))
							.From(targetSchemaName)
							.Where(targetSchemaName, "Id")
							.IsEqual("s", "Id")));
				processedRecords = deleteQuery.Execute(_dbExecutor);
			} while (processedRecords != 0);
		}

This is just one example of the logic. You can use:

 

select * from SysSchemaSource

where Source like '%DeleteQuery%'

 

to get other schemas in the application configuration with delete queries examples and build your own one using all examples you may find in the system.

Hi Oleg,

 

using these Delete classes bypasses Creatio’s internal logic though, right? So change logs will be inaccurate and any BPs that should be triggered on delete would not be triggered etc. This seems risky to me as important processes could hang off this, and I don’t know what other internal aspects of Creatio might be relying on logic that Creatio manages at an application level.

 

Is there any way to bulk delete while respecting that?

Show all comments

Hi community,

There is a system user needs to operate with records in several different objects. But I don't want that user can delete any records

Is there any way to set up permission for that?

 

Thank you!

Like 0

Like

1 comments

Hi, yes, there is a way to set it up. The necessary information you will find in this article: https://academy.creatio.com/docs/user/setup_and_administration/user_and…

Show all comments

Dear Community,

 

is there any way to block the deletion of records of an object for all users and user groups (including system administrators and the supervisor) depending on a lookup value, such as a status.

Adjusting the object permissions still let's sysadmins delete a record.

 

Like 0

Like

1 comments

Hello Markus,

You can write your own EventListeren on onDeletnig event and if your condition is satisfied, you can call base.OnDeleting(sender, e).

If not, it will block the delete action no matter who is the user.

public override void OnDeleting(object sender, EntityBeforeEventArgs e) {
				var entityOrderProduct = (Entity)sender;
            	var OrderProductid = entityOrderProduct.PrimaryColumnValue;
				string name = entityOrderProduct.GetTypedColumnValue<string>("Name");
				if (name != 'someting'){
					base.OnDeleting(sender, e);
				}
			}

 

Show all comments

How to recover a deleted contact?

Like 0

Like

3 comments

Hello Artem,

 

If the contact was fully deleted from the system, it cannot be restored, sorry.

WHat if that contact was merged, instead of deleting of it? can we see merged record's information in somewhere? 

Ismet Sinan Ekici,

There is no such possibility in our system.

Show all comments

Hello community,

 

Is there any function like the save: function(), but that is triggered by the deletion of a record?

Like 0

Like

3 comments

Hello,

 

Could you please describe what logic exactly you are trying to achieve in more detail?

 

Best regards,

Mira

Mira Dmitruk,

I am trying to do some operations when I delete a record.

If the function is lets say, onDelete: function() {

       this.callParent(arguments); // here the item will be deleted

       // here is my code, that needs to get triggered only when a record is deleted. this is mainly what I am looking for

}

 

Thank you!

The function is called (for both Sections and Details) is "deleteRecords" - this is implemented in the GridUtilitiesV2 mixin used by details and section lists. However, be aware there are many ways a record can be deleted. It might be best to implement any logic that needs to occur on record deleted as a process rather than in any/all places where the record could be deleted in the UI?

Ryan

Show all comments

Hi Community,

 

Any example how to do server side esq to delete records with multiple filter condition?

 

Thanks

Like 0

Like

1 comments

Hello Fulgen,

 

You can find many examples by searching terrasoft source code files if You have local instance of Creatio.

 

One of example with multiple filters is from UpdateTargetAudienceProcessHelper.MarketingCommon.cs

		public virtual void ClearCurrentTargets() {
			new Delete(UserConnection)
	.From(TargetSchemaName)
	.Where("IsFromGroup").IsEqual(Column.Parameter(true))
	.And(TargetSchemaBindingColumnValueName).IsEqual(Column.Parameter(RootSchemaRecordId))
	.And(ResponseColumnName).IsEqual(Column.Parameter(DefResponseId))
	.Execute();
		}

 

Best regards,

Marcin

Show all comments

Dear Community,

 

Does anyone know a way of recovering a deleted record?

More specifically, a deleted contact? 

 

If this is not an OOB functionality, is there a way to activate this manually or with a marketplace addon?

Thank you in advance!

 

 

Kind regards,

Yosef

Like 0

Like

1 comments
Best reply

Hello Yosef,

 

As for now there is no easy way to restore the record in case it was deleted. As an option, you can restore the instance where the record was deleted from the previously created database backups to restore deleted data.

We also have a problem registered to our R&D team to implement the easy records restoration functionality in one of future versions of the application. I will assign this case to the project in order to increase its priority.

Thank you for helping us to make our application better!

 

Best regards,

Anastasiia

Hello Yosef,

 

As for now there is no easy way to restore the record in case it was deleted. As an option, you can restore the instance where the record was deleted from the previously created database backups to restore deleted data.

We also have a problem registered to our R&D team to implement the easy records restoration functionality in one of future versions of the application. I will assign this case to the project in order to increase its priority.

Thank you for helping us to make our application better!

 

Best regards,

Anastasiia

Show all comments

Hi Community,

 

We are unable to delete records "used in another process". We tried both "Delete connected records also" and "Do not deleted connected records" but it is just going over and over again to another page where you are asked again to choose between the two options.

 

Thank you

Like 0

Like

3 comments

Dear Fulgen,



Please, create a ticket for technical support mentioning the name of your instance and providing external access to it.



Thank you in advance,

Ivanna.

Hi,

 

did you find a solution for this?

 

We are having the same problem and would really need a solution!

 

Thanks and br,

Robert

Ivanna Yatsura,

 

This is in our on premise system, could you provide the solution please, We will execute it ion our on premise system.

Show all comments