back to top

Adding to a List from a Lookup on a Freedom UI Page

In my previous article I outlined how to invoke a lookup dialog on a Freedom UI page. In this article, we’ll expand on that idea to allow adding to a list from a lookup. For this sample, we have a list on the account page of products owned by the account. We’ll add a button to invoke a lookup to allow the user to select one or multiple products to add to the account’s product list.

The end result will be as follows:

The code to accomplish this will be very similar to the previous article. The main difference will be that instead of flattening out the text values of the selected items, we’ll use a model Insert to add the records.

View Inserting a Record from Client-Side Code Using the Model Class

Note, first make sure you’re adding the Creatio devkit to the page as sdk (see article above). The code for the request of the click of our button will look like this:

request.$context.executeRequest({
	type: "crt.OpenLookupPageRequest",
	$context: request.$context,
	entitySchemaName: "Product",
	caption: "Select products to add to the account",
	features: {
		select: {
			multiple: true,
			selectAll: false,
			resultType: 'lookupValues'
		},
		create: {
			enabled: false
		}
	},
	afterClosed: async function(selectedItems) {
		// add each selected item from the lookup to the list
		
		const accountId = await request.$context.Id;
		const accountProdModel = await sdk.Model.create("UsrAccountProduct");
							
		selectedItems.forEach(product => {
			accountProdModel.insert({
				UsrAccount: accountId,
				UsrProduct: product.value
			});
		});
	}
});

To make it so the items appear in the list without the need to refresh it, simply enable live data update for the entity you’re adding to.

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.

11 COMMENTS

  1. Information on how to add this custom code to the action of when a button is clicked would be useful. I think there is another CustomerFX article on it that could be used to link to for this purpose.

  2. hello!
    Could you please provide more detail about where to place the code u provided? I am quite new with creatio platform, and I don’t know what to do with your code, how can i make it work?

  3. Hi Ryan,
    I need to filter the page that is opening in OpenLookupPageRequest. I have added filtersConfig : filters, but it’s not working. Can you provide an example on that. Thanks in advance.

  4. Hi Ryan,
    Would it be feasible to include a filter feature in the open modal ? This would allow users to customize their results. Thanks in advance.

  5. Hi Ryan,

    I’ve encountered an issue when setting selectAll: true. Specifically, when I attempt to save the selected items, I receive the following error:

    { resultType: ‘lookupValues’, selectAll: true, … } is not supported. Use { resultType: ‘lookupValues’, selectAll: false, … } or { resultType: ‘filter’, selectAll: true, … } instead.

    Could you help me understand the root cause of this issue? Additionally, do you have an example implementation that uses the selectAll setting correctly?

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