back to top

Finding the Current Parent Record ID in SalesLogix Web

Sometimes it’s the easiest things that can be a big barrier to entry for getting started with something. I was reminded of this recently with some forum posts on slxdeveloper.com. Something as simple as getting the ID value of the current record can get in the way of getting the real work done if you’re just getting started. Since I couldn’t find an existing blog post on this topic on our website I figured it was time. Let’s take a look at a few different ways to do this.

Like many things in SalesLogix Web, there are a few different ways to do this, depending on where you’re using the code.

In a Code Snippet Action

A Code Snippet Action you can write code in C# or VB.NET since a Code Snippet Action is compiled into a separate DLL that is referenced by the web client. In a Code Snippet Action you have a built-in reference to the form which you can use to get to other things, such as the EntityContextService. Here’s the code:

// Get a reference to the EntityContextServce
// and call GetEntity() - note, in this example are current entity is an account
IAccount myparent = form.WorkItem.Services.Get<Sage.Platform.Application.IEntityContextService>().GetEntity() as IAccount;

In a C# Snippet Action

A C# Snippet Action is different than a Code Snippet Action. As the name implies, it can only be C#. This is because it is placed right into the ASCX user control when you build the web platform (and SalesLogix is a C# application). The form, or user control, is called a SmartPart. It has a built in method called GetParentEntity that will do the job nicely. Here’s the code:

Sage.Entity.Interfaces.IAccount myparent = this.GetParentEntity() as Sage.Entity.Interfaces.IAccount;

In Client-Side Javascript

If you happen to be creating client-side javascript, you can get the current record ID there as well using the ClientEntityContext service.

var contextSvc = Sage.Services.getService('ClientEntityContext');
var context = contextSvc.getContext();
var entityId = context.EntityId; 

As an ASP.NET Query String Parameter

Lastly, since SalesLogix is an ASP.NET application, and when you access a record there is always an “entityid” parameter in the URL, you can resort to just ASP.NET methods to get the value from the query string.

string id = Request.QueryString["entityId"];

One thing to note: If your entity has a relationship to the parent, you can also access the parent via the relationship’s object property. However, if the code is in a LoadAction for an Insert form, the parent will not yet have been set.

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.

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