Hello,

 

What is the correct way to add custom field to System user page? Currently it is necessary to modify VwSysAdminUnit view, but it seems to be bad idea (as this view is overwritten with new versions of Creatio)



Do other options exist?

Like 1

Like

1 comments

Hello Vladimir,

 

Unfortunately, as for now, there is no possibility to change the system user page layout with the help of out-of-the-box tools of the application and we do have a correspondent problem registered on our side.



As for now theoretically, the only way to change the layout (or to add existing columns to the user page) is with the help of the replacing object (replace the "SysAdminUnit" object from the "Base" package) and replace the "UserPageV2" schema from "UIv2" package, but we should warn you that it is risky to do because it can break base application logic and provoke critically errors.



Actually, we don't recommend performing changes to this object and schema, but if you want to try - please use the dev-instance or local instance first so to test this possibility and then, if it was successful, perform the same steps on prod.

Show all comments

How can i hide / show a field based on the user role in freedom UI with business rules or with js code?

Thank you

Like 2

Like

6 comments
Best reply

You can do this with code on a Freedom UI page. 

1) Make sure you add "@creatio-devkit/common" to the page as sdk

2) First add an attribute to the viewModelConfig. I'll call the attribute "IsUserInRole since we'll set it to true/false if the user is in the role. 

viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{
    "attributes": {
        "IsUserInRole": {}
    }
}/**SCHEMA_VIEW_MODEL_CONFIG*/

3) Bind the attribute to the visible property of the control by adding the following to the control in the viewModelDiff

"visible": "$IsUserInRole"

4) Now when the view model is initialized, basically the Freedom UI equivalent of the onEntityInitialized on classic pages, do a query using the model to determine if the current user is in the role. We'll use that result to set the attribute:

{
    request: "crt.HandleViewModelInitRequest",
    handler: async (request, next) => {
        await next?.handle(request);
        // get current user
        const sysValuesService = new sdk.SysValuesService();        
        const sysValues = await sysValuesService.loadSysValues();
        const currentUserContact = sysValues.userContact;
 
        // create model query
        userRoleModel = await sdk.Model.create("SysUserInRole");
        const filter = new sdk.FilterGroup();
        await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysRole.Name", "The Role Name Here");
        await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysUser.Contact", currentUserContact.value);
 
        // workaround for filters, will be fixed in 8.1
        const newFilter = Object.assign({}, filter);
        newFilter.items = filter.items;
 
        const results = await userRoleModel.load({
            attributes: ["Id"],
            parameters: [{
                type: sdk.ModelParameterType.Filter,
                value: newFilter
            }]
        });
 
        // now set attribute
        request.$context.IsUserInRole = results.length > 0;
    }
}

I didn't test that code, but it should be pretty close. If anything you might need to play with the filter for the model query.

Ryan

Hello,

 

Unfortunately, there is no way to add visibility to the field based on user role via Section Wizard.

 

But we've registered it in our R&D team backlog for consideration and implementation in future application releases.

 

Thank you for helping us to improve our product. 

Bogdan,

but is it possible to calculate page parameter based on Operation permission? And then use this parameter in business rule?

You can do this with code on a Freedom UI page. 

1) Make sure you add "@creatio-devkit/common" to the page as sdk

2) First add an attribute to the viewModelConfig. I'll call the attribute "IsUserInRole since we'll set it to true/false if the user is in the role. 

viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{
    "attributes": {
        "IsUserInRole": {}
    }
}/**SCHEMA_VIEW_MODEL_CONFIG*/

3) Bind the attribute to the visible property of the control by adding the following to the control in the viewModelDiff

"visible": "$IsUserInRole"

4) Now when the view model is initialized, basically the Freedom UI equivalent of the onEntityInitialized on classic pages, do a query using the model to determine if the current user is in the role. We'll use that result to set the attribute:

{
    request: "crt.HandleViewModelInitRequest",
    handler: async (request, next) => {
        await next?.handle(request);
        // get current user
        const sysValuesService = new sdk.SysValuesService();        
        const sysValues = await sysValuesService.loadSysValues();
        const currentUserContact = sysValues.userContact;
 
        // create model query
        userRoleModel = await sdk.Model.create("SysUserInRole");
        const filter = new sdk.FilterGroup();
        await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysRole.Name", "The Role Name Here");
        await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysUser.Contact", currentUserContact.value);
 
        // workaround for filters, will be fixed in 8.1
        const newFilter = Object.assign({}, filter);
        newFilter.items = filter.items;
 
        const results = await userRoleModel.load({
            attributes: ["Id"],
            parameters: [{
                type: sdk.ModelParameterType.Filter,
                value: newFilter
            }]
        });
 
        // now set attribute
        request.$context.IsUserInRole = results.length > 0;
    }
}

I didn't test that code, but it should be pretty close. If anything you might need to play with the filter for the model query.

Ryan

Thank you. That helps a lot.

Ryan Farley,



I have tried a similar case, where on saving a record writing a validation to check whether it has unique "Code".

 

request: "crt.SaveRecordRequest",handler: async (request, next) => {
// Add any code to execute *before* the save here
 
var accountModel = await sdk.Model.create("Account");
 
const filter = new sdk.FilterGroup();
var codeValue = await request.$context.StringAttribute_enupz4g;
await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SMCode", codeValue);
 
	const newFilter = Object.assign({}, filter);
	newFilter.items = filter.items;
 
	const accounts = await accountModel.load({
		attributes: ["Id"],
		parameters: [{
		type: sdk.ModelParameterType.PrimaryColumnValue,
		value: newFilter
		}]
	});
	if(accounts.length > 0){
		isSave = false;
		//Show warning Message
		request.$context.executeRequest({
		type: "crt.ShowDialogRequest",
		$context: request.$context,
		dialogConfig: {
		data: {
		message: "Code already already exists",
		actions: [{
			key: "OK",
			config: {
			color: "primary",
			caption: "OK"
			}
		}]
		}
		}
	});
	}
else{
return next.handle(request);
}
}



I followed your code to check any account has the similar code. Seems like, there is an issue in the filter it throws the below error.







Can you help me in adding the proper filter in this Freedom UI? Or provide a sample code to add filters to retrive data from an entity.



Regards,

Adharsh S

Adharsh,

Change this part: 

const accounts = await accountModel.load({
	attributes: ["Id"],
	parameters: [{
		type: sdk.ModelParameterType.PrimaryColumnValue,
		value: newFilter
	}]
});

To this: 

const accounts = await accountModel.load({
	attributes: ["Id"],
	parameters: [{
		type: sdk.ModelParameterType.Filter,
		value: newFilter
	}]
});

Note, the difference in type. You're specifying a filter, not providing a primary column value. 

Ryan

Show all comments

Hi Everyone,

 

We have Loads in our environment and teams into which those loads are supposed to be divided equally. I want to know how can i do this with the business process?

Like 0

Like

4 comments

Hello, 

Thank you for your question!

Please note that the decimal separator logic is hard coded within the system core. Unfortunately, it is not possible to change it using basic user tools and we do not have a ready-made solution to resolve your problem.



We have already registered the following suggestion for our R&D department and they will consider the implementation of this functionality in future releases.

 

Viktoriia Hrynchuk,

Hi Vik,

 

Thank you for your response. If I have a Decimal variable of .00, then I can use it to divide into the same Decimal variable?

Hello!

 

To divide one number by another in a business process, we recommend using the "Formula" element available in Creatio. 

For detailed guidance on using the "Formula" element and other functionalities in Creatio, we encourage you to explore the Creatio Academy.

https://academy.creatio.com/docs/8-0/user/bpm_tools/business_process_se…

There, you will find comprehensive tutorials, guides, and resources that will help you make the most of our platform's capabilities.

 

Best regards,

Kate

Kate Karpik,

HI Kate,

 

Thank you for your response. I don't see anything regarding division in the academy.

Show all comments

Hello,

We have a page with a lot of fields and details. And this page should be used in Mobile App on iPad's.

Currently FreedomUi selects layout automaticaly, so fields and details are located not in order of business logic.

Can we use something like Tabs in mobile App?

Can we control layout and define where exact field or detail should be on the screen?



Thank you very much!

Vladimir

Like 3

Like

3 comments

Maybe Creatio 8.0.10 ?



Custom layouts for mobile. You can now have more control over the layout of mobile Freedom UI pages by setting up custom layouts in page metadata. For example, you can specify the order of Area layout elements.



https://academy.creatio.com/docs/release/release-notes/8010-atlas-relea…

Damien Collot,

Thank you, 

That's greate news. The only questions is how to do that. I haven't found any options for that in 8.0.10 trial

Hello!

 

In case in your mobile application the Freedom UI is set for the definite section, you can easily correct the elements layout for the tablet with help of metadata.

 

In case you will have any additional questions on this matter, just let me know. 

Show all comments

Hello Community,



We are trying to trigger a business process as soon as a product has been added to an order. The filter for the BP to trigger requires the Order's Type and Order stage, as we have a conversion formula written based on the type of order as a condition. The default condition is to end the process. Unfortunately, whenever we add multiple products to an order, the process triggers but goes through the default condition. We noticed that the record gets created, but there is a delay in updating the values in the record. Before the values of the record are updated, the process is triggered, and as there is no order type in the DB, the process doesn't meet any of the conditions written. As a result, it takes the default value and ends the process.

 

To overcome this issue, we initially placed a timer after the process trigger before reading the products in the order. While it did work for the initial set of products added, the problem arose when multiple products (e.g., 20 products) were added to the order simultaneously. The updating of the DB takes time for all 20 records, and before that, the process would have triggered and waited for the timer to complete (5 seconds) and moved on to read the record. Consequently, some processes again went with the default flow.

 

As a workaround, we rearranged the timer in between reading the products in the order and reading the order itself. Additionally, we implemented a loop that goes back to the product in order if the order type is not filled in. This solution seems to work, but the looping takes more time when there are multiple processes running. As you know, in Creatio, the processes may be triggered in parallel, but the execution happens sequentially. This leads to more time being taken for the process to complete execution due to the delay in creating a record in the DB and updating the values in the created record.

 

We had reached out to support, and they had suggested that in the above case, there is no data to read in the record at the moment the "Read data" element is started. Consequently, the action will not result in further BP processing. They provided a link (Read uncommitted) and suggested adding a custom C# code, which can call the BP after the transaction is completed (by overriding virtual void UpdateAmountsByOrderId). This will call the base logic and afterward, it will call the process was their suggestion

 

Here are the steps for better clarity:

  • A business process has been written for the conversion of the base price of the product based on the order type. The process is triggered when a product is added (Product in Order object), and the filter to trigger the process requires the Order Type and Order Stage to be filled in the Order object.
  • The Order is created first, and later the product is added in the web app. However, in the mobile app, the Order and product are added at the same time.
  • For example, if 20 products are added simultaneously, 20 processes are triggered, and they are executed in a FIFO way. Each process goes into a loop, leading to a subsequent delay in the execution of the process.

 

 

Question: As suggested by Creatio support, adding custom C# code to call the BP after the transaction is completed (i.e., when the record is created and values are updated), is there a sample code snippet available for the above scenario or an example snippet? Additionally, would like to know if this code snippet alone will work for both orders created from the web and mobile app, or if any code needs to be written in the mobile manifest to trigger the BP after the transaction is completed?



Regards,

Sivaranjani

Like 0

Like

5 comments

Hello,

The idea behind overriding a UpdateAmountsByOrderId is quite simple, you need to manually start your process after the base logic of the method is finished, for example:

 public virtual void UpdateAmountsByOrderId(Guid orderId) {
			var productsEsq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "OrderProduct");
			var idFilter = productsEsq.CreateFilterWithParameters(FilterComparisonType.Equal, "Order", orderId);
			productsEsq.Filters.Add(idFilter);
			var idColumn = productsEsq.AddColumn("Id");
			var productEntities = productsEsq.GetEntityCollection(UserConnection);
			UpdateAmountsInfo orderProductInfo = null;
			decimal orderAmount, currencyPrimaryFactor = 0;
			ExecuteInTransaction(executor => {
				foreach (Entity productEntity in productEntities) {
					var orderProductId = productEntity.GetTypedColumnValue<Guid>(idColumn.Name);
					orderProductInfo = ProtectedUpdateAmounts(orderProductId, dbExecutor: executor);
					currencyPrimaryFactor = orderProductInfo.OrderProductToPrimaryFactor;
				}
			});
			if (orderProductInfo == null) {
				var currencyInfo = GetOrderFinanceInfo(orderId);
				orderAmount = currencyInfo.Amount;
				currencyPrimaryFactor = GetToPrimaryFactor(currencyInfo.CurrencyInfo.Division, currencyInfo.CurrencyInfo.Rate);
			} else {
				orderAmount = orderProductInfo.OrderAmount;
			}
			UpdateSupplyPaymentElementsPercentageAndAmount(orderId, orderAmount, currencyPrimaryFactor);
 
	 		// Start the custom BP
 
	        // UserConnection userConnection = Get<UserConnection>("UserConnection");
			// IProcessEngine processEngine = userConnection.ProcessEngine;
			// IProcessExecutor processExecutor = processEngine.ProcessExecutor;
			// processExecutor.Execute("UsrTestProcess");
		}

An example of how to start a BP can be found in this article.

This should work for both web a mobile since this logic triggers every time and so you don't need to change a mobile manifest.

Dmytro Vovchenko,



Thanks for the response.



Could you please specify when the method (UpdateAmountsByOrderId ) will be triggered and please confirm whether we need to overide this method in 'OrderProductDetailV2' schema.



 

If I'm not mistaken, it works every time you add a product.

You need to override the schema OrderAmountHelper, there is no need to touch OrderProductDetailV2

Dmytro Vovchenko,

 

Thanks for the response.



Could you please share any article on overriding Source code in Creatio?

Sivaranjani,

Hello,

 

This is like in other C# projects: you need to inherit from the parent class and override the method. Some more information can be found here or here.

Show all comments

Hello Community,



We have a requirement to trigger a Business Process from Client schema. Since our client also uses Creatio mobile application, we need to figure out in which schema we need to write the code for achieving the same functionality in mobile application.

 

Any inputs on the schema names for achieving the above functionality would be helpful.



Regards,

Sivaranjani

Like 1

Like

1 comments

Hello Sivaranjani,

 

Business processes in the mobile application can only be triggered from the event (signal) that is used in the process (record adding\modification). So if you open a record, change some column value, save this record and you have a business process in the system that is triggered upon column modification then such process will be triggered.

 

Unfortunately mobile application doesn't support manual triggering of the business process from the client code. But our R&D team already has a task to make it possible to do using standard mobile application wizard and I've already informed them on this community post to raise the priority of this task. Thank you for helping us in making the app better!

Show all comments

Hi all,



I have multiple edit pages for a section in classic UI and I want to upgrade my instance to freedom UI. How can I set up several form pages in Freedom UI for a section?







Thanks in advance & regards

Goparna Nasina

Like 4

Like

5 comments
Best reply

Goparna Nasina,

This is now possible in Creatio 8.1.

Ryan

Not yet possible in Freedom UI.

Hi community,



Any update on the multiple edit pages in Freedom UI?

Currently we have 3 edit pages for opportunity in our classic UI instance and we wanted to convert the opportunity page to freedom UI page.

Kindly let us know how this can be done.



Thanks in advance

Goparna Nasina

Goparna Nasina,

This is now possible in Creatio 8.1.

Ryan

Ryan Farley,

Thanks Ryan

Ryan Farley,

 

I've a freedom UI section with three edit page, which depends on a lookup field.

Is it possible to control which user can use a specific edit page?

In the classic UI using record permission on lookup values and  a bit of javascript code I can hide the edit pages based on the current user.

Thank you

Show all comments

Hello,

we need to store long encrypted string in Lookup object. We have added Encrypted text field to the object, but when try to save string, get an error: "Maximum text length exceeded (1674/500)"

 

How is it possible to save long text in encrypted text field?

 

Thank you!

Like 2

Like

1 comments

Hello,

 

We have registered the idea and forwarded it for consideration to the responsible team for further review and release in one of the upcoming versions.

 

Currently, only workarounds at the client's business logic level are possible: either using a regular text field with maximum length and performing encryption of the value before saving and decryption after retrieval at the business logic level, or using two "Secure Text" fields and splitting your string into two substrings, storing them in the two fields, and concatenating them upon retrieval.



 

Show all comments

Hello Everyone,

 

We have an Orders page from which our invoices are generated. The rate of Invoices depends upon the Day of the Week. (Different rate for weekdays & Weekends). However, one key thing is missing which are UK Holidays. Is there any way to define UK holidays in the system or in my process, so that the system knows that this day is a holiday and the rate should be the holiday rate?

Like 1

Like

3 comments
Best reply

Hello Hassan,

 

You can achieve this in the following manner:

 

1) Create a custom object (parent object should be "BaseLookup") where two integer columns should be added: UsrDayOfHoliday and UsrMonthOfHoliday. They will be used to store the day and the month of holiday respectfully.

 

2) Create a lookup in the "Lookups" section based on the object from step 1 and fill it in:

3) Your business process that generates orders should be modified and additional check for the current day to be UK holiday should be added. Like in the example below:

The logic here is simple: get current day and month and set it as process integer parameters, then use these integer parameters in the "Read data" filtration. Then we have the "It's holdiday!" conditional flow with the following condition:

 

[#Get possible UK holiday.First item of resulting collection.Id#] != Guid.Empty

 

It will check if any record was found in the "Read data" element and if so the "It's holiday today!" autogenerated page will be displayed. Otherwise the process will be terminated. 

 

In your process you need to use the same approach but instead of the autogenerated page you need to trigger the logic you need to be triggered when it's holiday in UK. Otherwise trigger regular logic for other days.

 

Hope it helps!

Hi Community, Any Ideas for this?

Hello Hassan,

 

You can achieve this in the following manner:

 

1) Create a custom object (parent object should be "BaseLookup") where two integer columns should be added: UsrDayOfHoliday and UsrMonthOfHoliday. They will be used to store the day and the month of holiday respectfully.

 

2) Create a lookup in the "Lookups" section based on the object from step 1 and fill it in:

3) Your business process that generates orders should be modified and additional check for the current day to be UK holiday should be added. Like in the example below:

The logic here is simple: get current day and month and set it as process integer parameters, then use these integer parameters in the "Read data" filtration. Then we have the "It's holdiday!" conditional flow with the following condition:

 

[#Get possible UK holiday.First item of resulting collection.Id#] != Guid.Empty

 

It will check if any record was found in the "Read data" element and if so the "It's holiday today!" autogenerated page will be displayed. Otherwise the process will be terminated. 

 

In your process you need to use the same approach but instead of the autogenerated page you need to trigger the logic you need to be triggered when it's holiday in UK. Otherwise trigger regular logic for other days.

 

Hope it helps!

Oleg Drobina,

 

Hi Oleg,

 

This looks promising really! Will try this and update. Thanks for you help!!

Show all comments

Good day, colleagues!

Please help me understand the issue. On the OpportunitySection (and similarly on the LeadSection ), the system does not allow any changes to be made, not even adding a simple comment. I'm making changes to the schema that was automatically created when modifying in the section wizard. It's in my own package.

23505: duplicate key value violates unique constraint "IUSysSchemaUIdSysPackageId"



 

Like 1

Like

5 comments
Best reply

I get that in recent versions when I create a package and then set that as the current package. Once I log out and back in again the issue goes away (assuming that what you're getting is the same issue that I've experienced). Have you logged out and back in again since creating the package?

Ryan

I get that in recent versions when I create a package and then set that as the current package. Once I log out and back in again the issue goes away (assuming that what you're getting is the same issue that I've experienced). Have you logged out and back in again since creating the package?

Ryan

Ryan Farley,

The package was created a long time ago, but your advice helped me :)) That's strange. Thank you very much!

Hi! 

I'm getting the same message when I try to save a new Entity. Do we have an update on the possible cause of the issue?



Thanks,

Ignacio.

I had this error recently, except for it was within the business process table. It was trying to save another record with an empty Guid (one existed already). 



Couldn't get an answer on how this happened. My belief was that when you copy a business process, it creates an empty record whilst at the same time, my browser was not allowing the copied business process to open in the new tab. (only logical reason I could think of)



I would check the values in the table you mentioned to see where there is a duplicate key and then delete one of them. 

Same issue here. Someone has this resolve?

Show all comments