Automatically and Immediately Saving New Rows Added to an Editable Detail in Creatio

When working with an editable detail in Creatio, when the user adds a new row to the detail, a new row is added to the list, the user then can enter values, and then click the save button in the row action buttons. However, if you’d like, you can also force newly added rows to be immediately and automatically saved when the user clicks the add button.

To do this, you must override the AddNewRowToCollection method in the ConfigurationGridUtilities mixin that provides the editable list functionality. In that method, we can force the new row to be immediately saved. The code for all this would look like this:

addNewRowToCollection: function(newRow) {
	this.mixins.ConfigurationGridUtilities.addNewRowToCollection.apply(this, arguments);
	
	this.saveDataRow(newRow, null, this);
}

This code calls the base addNewRowToCollection method in the mixin. Then it calls the saveDataRow, passing the newly added row to be saved. One thing to note, the “null” param in the above code is a callback function. So, if you need to trigger any code to fire after the save has completed, you can add that there:

addNewRowToCollection: function(newRow) {
	this.mixins.ConfigurationGridUtilities.addNewRowToCollection.apply(this, arguments);
	
	this.saveDataRow(newRow, function() {
		this.console.log("Save has completed");
	}, this);
}

One thing to note here, you can also use the newRow object passed into this function to set values for the new row. Like this:

addNewRowToCollection: function(newRow) {
	this.mixins.ConfigurationGridUtilities.addNewRowToCollection.apply(this, arguments);

	newRow.set("UsrMyText", "This is the text");
	newRow.set("UsrMyNum", 123);
	//...	

	this.saveDataRow(newRow, null, this);
}

Then these values will be included in the record with the save. This also works, of course, without the auto-save as well to just set default values for the new row.

ABOUT THE AUTHOR

Ryan Farley

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.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!