back to top

Deleting a Record from Client-Side Code using the Model Class in a Creatio Freedom UI Page

In classic Creatio pages, to delete a new record you would use a DeleteQuery. Now, in Freedom UI pages you can delete records using the Model class that is a part of the Creatio DevKit SDK.

To use the devkit, you’ll need to add “@creatio-devkit/common” to the modules list of your page. This will look like this (note the “@creatio-devkit/common” in the square brackets and the sdk without quotes in the parenthesis):

define("UsrMyCustomEntity_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"] /**SCHEMA_DEPS*/, 
function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {
	return {
		// ... the rest of the page here
	};
});

Now, with that module available, you can access things in the SDK, such as the Model class. We’ll use this model class to create a model for a specific entity. Then, we’ll pass an array of filters for the record (or records) we want to delete. In this sample, we’ll be deleting a single account, so we’ll first create an account model, then pass the details of the account to delete to the Model’s delete function. Let’s look at the code to delete an account:

// create account model
const accountModel = await sdk.Model.create("Account");

// delete the new account
const result = await accountModel.delete([{
    type: sdk.ModelParameterType.PrimaryColumnValue,
    value: someAccountId
}]);

The result returned by the insert provides an object with the following properties:

  1. success: true/false
  2. rowsAffected: Number of rows affected by the operation, in this case, 1
Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Ryan Farley
Ryan Farleyhttps://customerfx.com/article/author/ryanfarley/
Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

2 COMMENTS

  1. Have you found a way to pass in custom filters (instead of the primary key filter shown in this article) to a delete model class query similar to how that can be done for the load function? I seem to be getting the following when trying to swap out the sdk.ModelParameterType.PrimaryColumnValue for a sdk.ModelParameterType.Filter:
    {
    “success”: false,
    “rowsAffected”: 0,
    “errorInfo”: “r.map is not a function”
    }

    Request that gives these results:
    const delResults = await audGenModel.delete({
    parameters: [{
    type: sdk.ModelParameterType.Filter,
    value: newFilters
    }]
    });

    I’ve tried using the pre-8.1.1 workaround for the filters but get the same error response.

    • Hi Harvey,

      Just confirmed that it does work for me. Just guessing, could it be that the records you’re deleting with the filter have related records, so they can’t be deleted? (If you delete them manually via the UI, do you get the popup about cannot be deleted due to related records?)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Using the AI Prompt to Create Dynamic Folders in Creatio

Using Creatio's AI prompt to create the filter for a dynamic folder works best if you specifically ask for that, and if you are as clear and direct as possible about the filtering, conditions.

Related Articles

AI Readiness Checklist for CRM Teams: Is Your CRM System Ready for AI?

Before using AI in Creatio, make sure your CRM data, users, processes, and automation foundation are ready. Use this practical AI readiness checklist for CRM teams.

Build Your Creatio AI Skills with the 2026 AI Summer Program

Join Creatio’s free 2026 AI Summer Program to learn how to identify, build, deploy, and manage AI agents.

Creatio 10x Is Coming: Join the Webinar to Explore the Future of AI-Native CRM

Learn what's new in Creatio 10x and how AI-native CRM, agentic AI, and no-code automation are shaping the future of customer relationship management. Join the upcoming webinar and discover what's next.

Creatio Unlimited Pricing Explained: AI Packages, Costs, Pros & Cons

Learn what Creatio’s new Unlimited pricing model includes, what it doesn’t include, how AI Action packages work, and the pros and cons for businesses evaluating Creatio.

Related Videos