Question

Virtual detail in freedom UI

Does anyone have any suggestions on how to build a virtual detail like in the example below, for the Freedom UI? The goal is to display data from an external source(API)

 

Is it possible to do this via the FreedomUI List control? Or do we have to build a component based on a detail from the Classic UI?

 

Reference: https://community.creatio.com/articles/add-virtual-detail-page

 

Thanks in advance!

Like 6

Like

12 comments

Actually it would amazing to have a full tutorial on this

Good day,

 

Thank you for bringing this need to our attention. We've registered your request and forwarded it to the responsible team of product analysts.

 

Best regards,

Pavlo!

 

Pavlo Sokil,

Hello. 

Any updates on this question?

I’d love to start working with Freedom UI, and this feature is really necessary :)

Im looking the same functionality

Pavlo Sokil,

 

Thanks, any feedback 🙂?

Hi all. I think I have some kind of a solution.

 

1. Create an object, mark it as virtual (I created UsrMyObject with only two fields - UsrId and UsrName, just for testing)

2. Add 'crt.DataGrid' on your page with this dataSource.

(Probably Section Wizard doesn't allow selecting virtual objects as a dataSource, so you can create an object, then create crt.DataGrid, and after that mark that object as virtual)

3. Create a C# class that implements IEntitySchemaQueryExecutor. It has one method GetEntityCollection. Call your webservice there and fill EntityCollection or just create some entites in it and return them (see code below).

(There are examples by Terrasoft, you can find them by interface’s name)

4. Currently it works with IEntitySchemaQueryExecutor, but it’s marked as obsolete in Creatio 8.0.9 so we'll need to use another interface in the future - IEntityQueryExecutor, it has the same method but different parameter.



P.S. I believe it works with both - Freedom UI and Classic UI.

namespace Terrasoft.Configuration
{
	using System;
	using Terrasoft.Core;
	using Terrasoft.Core.Entities;
	using Terrasoft.Core.Factories;
 
	[DefaultBinding(typeof(IEntitySchemaQueryExecutor), Name = "UsrMyObjectQueryExecutor")]
	public class UsrMyObjectQueryExecutor : IEntitySchemaQueryExecutor
	{
		private readonly UserConnection _userConnection;
 
		public UsrMyObjectQueryExecutor(UserConnection userConnection) {
			_userConnection = userConnection;
		}
 
		public EntityCollection GetEntityCollection(EntitySchemaQueryFilterCollection filters) {
			var collection = new EntityCollection(_userConnection, "UsrMyObject");
 
			var testmanager = _userConnection.EntitySchemaManager.GetInstanceByName("UsrMyObject");
 
			var entity1 = testmanager.CreateEntity(_userConnection);
			entity1.SetColumnValue("UsrId", Guid.NewGuid());
			entity1.SetColumnValue("UsrName", "Name 1");
 
			var entity2 = testmanager.CreateEntity(_userConnection);
			entity2.SetColumnValue("UsrId", Guid.NewGuid());
			entity2.SetColumnValue("UsrName", "Name 2");
 
			var entity3 = testmanager.CreateEntity(_userConnection);
			entity3.SetColumnValue("UsrId", Guid.NewGuid());
			entity3.SetColumnValue("UsrName", "Name 3");
 
			collection.Add(entity1);
			collection.Add(entity2);
			collection.Add(entity3);
 
			return collection;
		}
	}
}

And here we have them.

Alex Zaslavsky,

This is great news Alex. I will try this approach. Thanks for the help 

Someone implement this in 8.1?

Hello Federico, here is example of the same logic for 8.1.1. My new object is named UsrMyVirtualObject. I had to temporary set its Virtual property off (but no publish), then set this object at Expandable List, save page setup, and then turn Virtual = on and publish the object.

namespace Terrasoft.Configuration
{
    using System;
    using Terrasoft.Core;
    using Terrasoft.Core.Entities;
    using Terrasoft.Core.Factories;
 
    #region Class: UsrMyVirtualObjectQueryExecutor
 
    [DefaultBinding(typeof(IEntityQueryExecutor), Name = "UsrMyVirtualObjectQueryExecutor")]
    public class UsrMyVirtualObjectQueryExecutor : IEntityQueryExecutor
    {
 
        #region Fields: Private
 
        private readonly UserConnection _userConnection;
 
        #endregion
        #region Constructors: Public
 
        public UsrMyVirtualObjectQueryExecutor(UserConnection userConnection)
        {
            _userConnection = userConnection;
        }
 
        #endregion
        #region Methods: Public
 
        /// <param name="filters">Filters.</param>
        public EntityCollection GetEntityCollection(EntitySchemaQuery esq)
        {
            var collection = new EntityCollection(_userConnection, "UsrMyVirtualObject");
 
            var testmanager = _userConnection.EntitySchemaManager.GetInstanceByName("UsrMyVirtualObject");
 
            var entity1 = testmanager.CreateEntity(_userConnection);
            entity1.SetColumnValue("UsrId", Guid.NewGuid());
            entity1.SetColumnValue("UsrIntValue", 111222);
 
            var entity2 = testmanager.CreateEntity(_userConnection);
            entity2.SetColumnValue("UsrId", Guid.NewGuid());
            entity2.SetColumnValue("UsrIntValue", 222333);
 
            var entity3 = testmanager.CreateEntity(_userConnection);
            entity3.SetColumnValue("UsrId", Guid.NewGuid());
            entity3.SetColumnValue("UsrIntValue", 444555);
 
            collection.Add(entity1);
            collection.Add(entity2);
            collection.Add(entity3);
 
            return collection;
        }
        #endregion
    }
    #endregion
}

 

I used SysUserProfileQueryExecutor as a good and simple example. You can search for other base product examples by keyword "IEntityQueryExecutor" through all *.cs files in base product folders.

Dmitriy Gamora,

 

Thank you Dmitriy for the solution works perfectly!

 

Just adding an example of how to bind lookups in case we want to add a lookup to a regular object in Creatio the code will just be like this:

       var entity3 = testmanager.CreateEntity(_userConnection);
            entity3.SetColumnValue("UsrId", Guid.NewGuid());
 
//You need to add one for the Id and another for the display value. Be aware the Name is the display name of the object. In the case of the Account object is Name. If you have other like Order it will be Number.
            entity3.SetColumnValue("UsrAccountId", new Guid("405947d0-2ffb-4ded-8675-0475f19f5a81"));
          entity3.SetColumnValue("UsrAccountName", new Guid("Accom (sample)"));

 

Dmitriy Gamora,

 

Thank you, this is useful. I can customize the contents of GetEntityCollection and call webservice and fill the EntityCollection. 

 

Additional question, to make it dynamic how we can pass parameter from Form Page to GetEntityCollection method? On the webservice I need to pass some parameter to fetch only selected record. This parameter should come from Form Page to make it dynamic.

 

Show all comments