back to top

Programatically Adding a New Record in SalesLogix Web

Something that is a common task in development, yet one that I get a lot of questions about, is how to programatically add a new record in SalesLogix Web using the entity model. This is an easy task, but unless you have some examples to learn from you might not know where to start. Let’s take a look.

The EntityFactory is something you need to get familiar with. Get Reflector and dig around the Sage.Platform.dll to take a look. You’ll use the EntityFactory to Create & Delete data. You can also use it to get a record by ID and to get a repository to query data in the entity model. Let’s just take a look at using it to Create a new entity instance that we can save (which will add the new record to the database).

Scenario

Let’s say we have an entity named Certification, which has a 1:M relationship to the Contact. We’ll create a form under the contact where the user can choose a “certification” from a picklist and click an “add” button. We’ll also put a DataGrid on the Form to display the certifications for the contact. When the “add” button is clicked we’ll programatically create the certification record using the value the user selected in the picklist. Since the only selection to make is the certification, I like to do things like this instead of using a separate “add” form in a dialog that only contains a single control (the picklist). We’ve done away with the need to use an add dialog by just placing the picklist and add button controls right above the grid on the form itself.

The Code

The code that we’ll execute on the Click of the add button would look as follows:

// make sure the user has selected a certification in the picklist
if (picklistCert.PickListValue != string.Empty)
{
// get a reference to the current Contact
Sage.Entity.Interfaces.IContact contact = this.BindingSource.Current as Sage.Entity.Interfaces.IContact;

// programatically create a Certification and save it.
// use the EntityFactory to create a new instance of the Certification entity
Sage.Entity.Interfaces.ICertification certification = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.ICertification>();
// now just set the properties & save
certification.Contact = contact;
certification.CertificationName = picklistCert.PickListValue;
certification.Save();

// add the certification to the contact's Certification collection.
// this is only needed to cause the grid bound to contact.Certifications to refresh
contact.Certifications.Add(certification);

picklistCert.PickListValue = string.Empty;
}
else
{
// if the user clicked the add button without first choosing a certification display a message
this.DialogService.ShowMessage("You must first select a certification to add. Please try again");
}

You can see that the only tricky part is knowing how to create the new entity instance using the EntityFactory (I’ve bolded that line in the code above). Once you have that it is just a matter of setting the needed properties and saving it. Much easier than using a SQL INSERT statement or even adding a new record to an updateable ADO Recordset like how you would do this in the LAN client.

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.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos