Restricting the Related Assets SData Lookup for Tickets in the Infor CRM (Saleslogix) Web Client

When associating a related asset to a ticket in the Infor CRM Web Client (Saleslogix), the out of the box behavior will show all assets in the system in the lookup to select an asset. This doesn’t make a whole lot of sense for most people since they usually want to relate an asset that the account the ticket is for actually has, not just any asset in the system. Let’s take a look at how to customize this lookup to only show assets for the ticket’s account.

This lookup isn’t a standard lookup. The related assets grid is an editable SData grid, and the lookup is an SData lookup. When we’re taking about restricting the results of this lookup, we’re really talking about adding a where param to the SData call that populates the results of the lookup.

In Application Architect, 1) Select the grid on the TicketAssets form, 2) in the property editor, open “Tools” and select “Relate” 3) expand “Lookup Properties” 4) locate the property for “ConditionalWhere”

Ticket Assets - Lookup - ConditionalWhere

Open the editor for the ConditionalWhere. This editor is expecting some Javascript. We need to return a valid “where” param that will be included in the SData request, so it will need to be formed as something that SData understands. What we want in this case is to say “where the account product is for the current account”. Obviously, we need the ticket’s account ID value. If we needed the ticket’s ID, we could simply use:

var ticketId = Sage.Utility.getCurrentEntityId();

However, that won’t really help us here. We need the ticket’s account ID. To get the ticket’s account ID, we can just use dojo.byId to find the Account lookup on the ticket details, and then read the ID value from that. Our code will look like this:

function() {
	var accountLookup = dojo.byId('MainContent_TicketDetails_lueAccount_LookupResult');
	if (!accountLookup) return '';
	var accountId = accountLookup.value;
	if (!accountId) return '';
	return "Account.Id eq '" + accountId + "'";

Paste the code above into the editor, then build & deploy. The lookup to relate an asset will now only show assets for the ticket’s account. Note: this code assumes that you’ve not renamed the Account lookup on the TicketDetails form (out of the box it is named “lueAccount”).


Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of 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.

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!