Hi,

 

I have a Freedom UI list where I can take a few actions after the user has selected one or more rows. The actions run as expected, but the records are kept selected after the actions run and the user has to manually clear the selection. What do I need to add to the custom code to clear the selection? 

Thanks,
Jose 

File attachments
Like 0

Like

6 comments
Best reply

Jose Hernandez,

 

You need to try

 

request.$context.GridDetail_tviz7gf_SelectionState = null
 

null is needed to remove the selection, but also change GridDetail_tviz7gf to your list attribute.

Hello,

Could you describe exactly what your custom logic performs for better understanding?

Malika,

 

It depends on the action. The Unlock one just clears the locked by field for the selected cases. The print generates letters and sends them to our print vendor for each case selected. Finally, the Assign one opens a window where the user can select the person to assign the cases to. Each one is calling the code below with the proper parameters.

I just need to know what I need to add to that code to clear the selection after the code that runs the business process.

 

Thanks,

Jose

        processSelectedRows: async function(request, processName, message, next) {
            var selectedRecords = await this.getSelectedRows(request.$context);
            var count = selectedRecords.count;
            var date = new Date();
            var hours = date.getHours();
            var minutes = date.getMinutes();
            var ampm = hours >= 12 ? 'PM' : 'AM';
            hours = hours > 12 ? hours - 12 : hours;
            var timeString = hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0') + " " + ampm;
            message = message + " on " + timeString + " for " +  count + " selected records.";
            request.$context.executeRequest({
                type: "crt.NotificationRequest",
                message:message
            });
            const handlerChain = sdk.HandlerChainService.instance;
            result = await handlerChain.process({
                type: 'crt.RunBusinessProcessRequest',
                processName: processName,
                processRunType: "RegardlessOfThePage",
                processParameters: {
                    "SelectedRecords": selectedRecords.selected
                },
                $context: request.$context
            });
            if (!result.success)  {
                var errorMsg = Ext.String.format(resources.localizableStrings.UnableToProcessSelectedRows, processName, result.errorInfo?.message);
                request.$context.executeRequest({
                    type: "crt.NotificationRequest",
                    message: errorMsg
                });                        
            }
            /* Call the next handler if it exists and return its result. */
            return next?.handle(request);
        }

I've not tried clearing the selections, but it might work to do this after you execute the process: 

request.$context.DataTable_SelectionState.selected = [];

Or it could be that you'll set SelectionState to null or {}?

Ryan

Ryan Farley,

Thanks Ryan. I tried that (and other variations like setting the type to 'clear') and the model gets cleared, but the GUI is not refreshed. In other worlds on the page the records are still showing as selected even though the model now has cleared the selection.

Jose Hernandez,

 

You need to try

 

request.$context.GridDetail_tviz7gf_SelectionState = null
 

null is needed to remove the selection, but also change GridDetail_tviz7gf to your list attribute.

Thanks Oleg. That worked. In my case I used  request.$context.DataTable_SelectionState = null; 

Show all comments

Hi, 

 

Any ideas why the code below is not working? I get an 'Object reference not set to an instance of an object.' here /0/DataService/json/SyncReply/SelectQuery 

I checked that the getUsersInRole function that I wrote is working. It returns an array of Contact Ids.

Thanks in advance,
Jose

{
    request: 'crt.LoadDataRequest',
    handler: async (request, next) => {
        if (request.dataSourceName === 'PageParameters_UsrLookupParameter1_13p73tg_List_DS') {
            var roleId = request.$context.attributes.PageParameters_UsrLookupParameter1_atde2dj?.value;
            var users = await UsrC2CUtilitiesV2.getUsersInRole(roleId);
            const usersFilter = new sdk.FilterGroup();
            await usersFilter.addSchemaColumnInFilterWithParameters(sdk.ComparisonType.Equal, "Id", users);                            
            request.parameters.push({
                type: "filter",
                value: usersFilter
            });
        }
        return await next?.handle(request);
    }
}

Like 0

Like

3 comments
Best reply

hi Jose,

try to use newFilter instead of usersFilter in the push

// workaround for filters required in Creatio 8.1.0 and older
const newFilter = Object.assign({}, usersFilter);
newFilter.items = usersFilter.items;

Hello,
Just on code alone, it is hard to tell what is the reason for the issue.
You need to do a debug and see at what moment the system cannot read the value.

hi Jose,

try to use newFilter instead of usersFilter in the push

// workaround for filters required in Creatio 8.1.0 and older
const newFilter = Object.assign({}, usersFilter);
newFilter.items = usersFilter.items;

Hi Stefano, 

That fixed my issue. 

Thanks!

Show all comments

Hi Team,

 

I am looking to data import for the product section and detail objects using a single excel template. In the contact and account sections, we have the option to import the additional address details.

 

Is that possible to get additional detail objects like this for the product section?

 

Regards,

Kumaran

Like 0

Like

1 comments

Dear Kumaran,

 

Thank you for your question!

 

Allow me to clarify how the import process works. When importing data into Creatio, you are essentially transferring the information from your Excel file into the corresponding database table. Each detail in Creatio corresponds to a different object or database table. Therefore, during an import, data can be inserted into one table or object at a time.

 

Import to Contact/Accounts have custom core logic applied, but all other objects work with logic described above.

 

You can read more about Excel import on Creatio Academy: https://academy.creatio.com/docs/8.x/creatio-apps/creatio-basics/busine…

 

Have a great day!

Show all comments

I have an organizational role name "Sales Reps" that has my account added in its Users area.

I also have a workplace named "Sales Reps" with the desired app under Sections and "Sales Reps" added under User groups.

 

When I log in to my account, I do not see any apps. There is also no dropdown menu at the top to change workplaces (see attached image). When I am logged in as Supervisor, I see apps as expected. 

 

What other steps do I need to take to grant my user access to an app? 

 

File attachments
Like 0

Like

2 comments

Hello,

 

Please use this documentation, which will help you:



https://academy.creatio.com/docs/8.x/setup-and-administration/administr…



Regards, 

Orkhan

Orkhan,

Thank you for the reply. Deleting the user and readding them fixed the problem. 

Show all comments