Hi Community,

I’m customizing a detail/list view in Creatio where each row includes fields like A1, A2, A3. One of the fields is a single text field, and I want to style individual words within this field — for example, giving each word a different background color.

This is similar to how the multi-select lookup component shows selected values with separate styling (like colored tags). I’m trying to recreate that effect for a regular text field in the list view.

To clarify:

  • I already know how to inject custom CSS using modules and global CSS variables
  • What I’m looking for is a way to apply styling dynamically at runtime, depending on the text content

Thanks in advance for your help!

Like 0

Like

2 comments

CSS alone doesn't work that way. You can't style single word within the same text using CSS. You'd need to manipulate the text so that each word would be wrapped in it's own span/div to be able to style them that way.

Show all comments

Hello. In a section page, I need to make the case number font bold, but according to a specific field value. I tried to do it based on several articles (https://community.creatio.com/questions/how-add-custom-style-control-pa… https://community.creatio.com/questions/bigger-font-name-list-record-di…). 

But I'm running out of ideas. I would be grateful for your help!

Something like this, but only for case number text.

Like 1

Like

9 comments
Best reply

Сергій Сермакшев,

 

&lt is the html code for < symbol, it's a "feature" of the code editor here in the Community:)

 

As for ModifierType

We have access to items that will be displayed in the grid and their position will be the same as in the response.collection.collection.items. You can pass response to the performStylesChange method and process it there as well and perform the check for the needed ModifierType and change styles only for those records.

 

Something like:

define("CaseSection", [], function() {
	return {
		entitySchemaName: "Case",
		messages: {},
		attributes: {},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			onGridDataLoaded: function(response) {
				this.callParent(arguments);
				this.performStylesChange(response);
			},
 
			performStylesChange: function(response) {
				var processedItemsIndexes = this.checkResponseCollection(response);
				var recordTitles = document.getElementsByClassName("grid-primary-column");
				for (var i = 0; i &lt; recordTitles.length; i++) {
					for (var j = 0; j &lt; processedItemsIndexes.length; j++) {
						if (processedItemsIndexes[j] == i) {
							var element = recordTitles[i];
							element.style.fontWeight = 'bold';
						}
					}
				}
			},
 
			checkResponseCollection: function(response) {
				var responseItems = response.collection.getItems();
				var processItemsIndexes = [];
				for (var i = 0; i &lt; responseItems.length; i++) {
					if (responseItems[i].values.Status.displayValue == "New") {
						processItemsIndexes.push(i);
					}
				}
				return processItemsIndexes;
			}
		}
	};
});

Here I marked tickets in the New status in bold text:

So you can use the same approach in your task.

Hello Serhiy,

Could you please clarify which step exactly you have problems with? 

Was it possible for you to make the text bold without conditions?

If so then how exactly do you add the specific field value? 

Anhelina writes:

Hello Serhiy,

Could you please clarify which step exactly you have problems with? 

Was it possible for you to make the text bold without conditions?

If so then how exactly do you add the specific field value? 

Thank you for your interest. I have overridden 2 methods: 

initQueryColumns: function(esq) {
	this.callParent(arguments);
 
	esq.addColumn("ModifiedBy.Type.Id", "ModifierType");
 
},
 
prepareResponseCollection: function(collection) {
	this.callParent(arguments);
	// Аor each record returned in the query for the list 		
	// check the Amount field value and then apply style
	collection.each(function(item) {
		if (item.get("ModifierType") == "00783ef6-f36b-1410-a883-16d83cab0980") {
			item.customStyle = Ext.apply(item.customStyle || {}, {
				"background-color": "#FFFFCC",
				"font-weight": "bold"
	        });
		}
	}, this);
}

I understand that I need to change this part of the code:

item.customStyle = Ext.apply(item.customStyle || {}, {
	"background-color": "#FFFFCC",
	"font-weight": "bold"
}

It must be something like this:

.title {
	"background-color": "#FFFFCC",
	"font-weight": "bold"
}

But I have no idea how to apply the style to a specific entry element in the list.

 

Сергій Сермакшев,

 

Hello,

 

Try another approach:

define("CaseSection", [], function() {
	return {
		entitySchemaName: "Case",
		messages: {},
		attributes: {},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			onGridDataLoaded: function(response) {
				this.callParent(arguments);
				this.performStylesChange();
			},
 
			performStylesChange: function() {
				var recordTitles = document.getElementsByClassName("grid-primary-column");
				for (var i = 0; i &lt; recordTitles.length; i++) {
					var element = recordTitles[i];
					element.style.fontWeight = 'bold';
				}
			}
		}
	};
});

The logic here is simple: once grid data is loaded we go through all elements on the page and change the style for the text to bold to all title columns (which is a case number). This is not the best solution, but it works properly when the list is loaded or sorting\filtering is changed in the list.

Oleg Drobina writes:

i <

Thank you. For some reason, it complained about "i &lt;" had to delete. Everything worked. 

But how to implement this part of the logic?

if (item.get("ModifierType") == "00783ef6-f36b-1410-a883-16d83cab0980")


It is necessary to highlight only those records where some field matches a specific record in the directory.

Сергій Сермакшев,

Hello. Here is an example. It uses jQuery, but you may easily adapt it to Oleg's example. Main idea is that items[i] is viewModel coresponding to recordTitles[i] DOM element from Oleg's example. 

applyCustomCss: function(){
	var gridData = this.getGridData();
	var items = gridData.getItems();
	var uiItems = $("div[column-name='ColorByProductType']");
 
 
	for (var i = 0; i &lt; items.length; i++){
		var height = $(uiItems[0]).css("height");
		var bgColor;
		var category = items[i].get("Product.SxGoodsCategory").value;
		if (category === SxProductConstants.GoodsCategory.Wine){
			var wineColor = items[i].get("Product.SxColor").value;
			if (wineColor === SxProductConstants.WineColor.Red){
				bgColor = "#cc0a0a";
			}
			else if (wineColor === SxProductConstants.WineColor.White){
				bgColor = "gold";
			}
			else if (wineColor === SxProductConstants.WineColor.Pink){
				bgColor = "pink";
			}
		}
		else if (category === SxProductConstants.GoodsCategory.Champagne){
			bgColor = "bisque";
		}
		else if (category === SxProductConstants.GoodsCategory.StrongAlcoholDrink){
			bgColor = "saddlebrown";
		}
		else if (category === SxProductConstants.GoodsCategory.Water){
			bgColor = "blue";
		}
		$(uiItems[i]).css(
			{"background-color": bgColor, 
			"border-radius": "50%",
			"vertical-align:": "middle",
			"margin-top": "7px",
			"margin-right": "2px",
			"width": height});
	}
},

 

And instead of oveeriding initQueryColumns method it is better to override getGridDataColumns

                getGridDataColumns: function () {
                   var baseGridDataColumns = this.callParent(arguments);
                   var gridDataColumns = {
                       "ModifiedBy.Type.Id": {path: "ModifiedBy.Type.Id"}
                   };
                   return Ext.apply(baseGridDataColumns, gridDataColumns);
               },

 

Сергій Сермакшев,

 

&lt is the html code for < symbol, it's a "feature" of the code editor here in the Community:)

 

As for ModifierType

We have access to items that will be displayed in the grid and their position will be the same as in the response.collection.collection.items. You can pass response to the performStylesChange method and process it there as well and perform the check for the needed ModifierType and change styles only for those records.

 

Something like:

define("CaseSection", [], function() {
	return {
		entitySchemaName: "Case",
		messages: {},
		attributes: {},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			onGridDataLoaded: function(response) {
				this.callParent(arguments);
				this.performStylesChange(response);
			},
 
			performStylesChange: function(response) {
				var processedItemsIndexes = this.checkResponseCollection(response);
				var recordTitles = document.getElementsByClassName("grid-primary-column");
				for (var i = 0; i &lt; recordTitles.length; i++) {
					for (var j = 0; j &lt; processedItemsIndexes.length; j++) {
						if (processedItemsIndexes[j] == i) {
							var element = recordTitles[i];
							element.style.fontWeight = 'bold';
						}
					}
				}
			},
 
			checkResponseCollection: function(response) {
				var responseItems = response.collection.getItems();
				var processItemsIndexes = [];
				for (var i = 0; i &lt; responseItems.length; i++) {
					if (responseItems[i].values.Status.displayValue == "New") {
						processItemsIndexes.push(i);
					}
				}
				return processItemsIndexes;
			}
		}
	};
});

Here I marked tickets in the New status in bold text:

So you can use the same approach in your task.

Oleg Drobina,

Thank you very much. With your help to solve this problem. It also gave me some insight into working with section entries via JavaScript.
Also, if you don't mind, tell me how to compare the "Contact Type" lookup value in the : "ModifiedBy" field. Something like  "ModifiedBy.Type.Id". Thank you again.

Сергій Сермакшев,

 

You are welcome!

 

As for ModifiedBy.Type - the easiest way is to display this column in the section list.

 

Alternatively you can add the initQueryColumns method override to the section methods in the following manner:

initQueryColumns: function(esq) {
				this.callParent(arguments);
				esq.addColumn("Owner.Type", "OwnerType");
			},

What I did here is add the Owner.Type column in the Cases section esq (Case has an Assignee (which is the Owner column that references the Contact entity) and I need to check the contact type specified in this column). As a result

we have access to this OwnerType in the context of the onGridDataLoaded and performStylesChange execution. We can also use it for style recalculation. In your case it should be similar but using another column. 

Oleg Drobina,

You are great. Everything worked out.

Show all comments

Hello,

I want to color rows in a list page whose date has passed (Freedom UI).

I tried to add a css file to my list page. I followed this article, but I still have a problem. When I look at the page's inspect, I see that a line has been added with a link to the file I added (
I would appreciate help.

Thanks, Smadar

Like 0

Like

1 comments

Can you give more specifics? Is the CSS not being applied to the page?

As long as the steps in the article are followed it does load the CSS on the page. The CSS itself would determine whether or not it actually applies to any elements.
Ryan

Show all comments

Hi Team,

 

I'm looking for a solution where i can apply colors to the Field values (not labels) using CSS on a conditional basis. I followed the article https://community.creatio.com/questions/conditional-formatting-field-ed… but it applies color on the label of the field, not the value div.

 

Kindly help.

Best Regards,

Sarika

Like 0

Like

4 comments

Hello,

to add colors to the value, if you know which div it is exactly, you can use the class or id of that div in the selector instead of ".label-wrap .t-label" as in step 1 of the example. Or you can look up the class or id by using inspector tool (Ctrl+shift+C) in the developer tools (f12) on your page and then use them in the selector. 

If you require more assistance please provide screenshots of div you want to color, would provide more clarity how to change the selector accordingly.

.

is there any updates on this?

Hello Sarika!

With CSS you can change the color by choosing the right selector. Example, where 2a879ccc-536d-45a9-980a-9ac0a00aea91 - id of value:

li[data-value="2a879ccc-536d-45a9-980a-9ac0a00aea91"] 
{
background-color: brown;
}

I would recommend you to use the new FreedomUI pages on the site. You can change bg-color in the system settings on the FreedomUI page (on your screen shot I can see Classic UI). It will take 10 min maximum.

To change colors with FreedomUI :

1) Open System designer -> Advanced settings

2) Find the Custom Object CasePriority or create a replacement:

3) Add the new column -> Other -> Color:

4) Add Title to the new Color column on the same page

5) Click on the Name of this object and choose value (Title name from p.4) in Color field:

6) Publish this object

7) Open System Designer -> Lookups -> Case priorities -> View -> Select fields to display:

8)Add HEX color code to the new column:

 

9) FreedomUI page will looks like:

 

 

 

Show all comments

Hi community,

We need to change the CSS of the detail’s header, inline editable column input text color, and the other non-editable grid text color.

What client module we should replace, and what classes we should change?

Thank you very much!

Like 0

Like

3 comments
Best reply

Andrew Sheng,

I got the answer! All I had left to do was to fill the JS code with:

 define("BaseGridDetailV2", ["css!UsrDynasafeDetailV2CSS"], function() {
	return {
		methods: {},
		diff: /**SCHEMA_DIFF*/[ ]/**SCHEMA_DIFF*/
	};
});

 

Hello Andrew,



It could be achieved by development, please find similar questions bt the links below:

https://community.creatio.com/questions/text-area-field-editable-detail….

 

https://community.creatio.com/questions/detail-styles-css?_gl=1*1850rv9….

Bogdan,

Hi Bogdan, thank you for the solution links. But the screenshots in the reply are no longer visible. I followed the two steps in the reply, but had no luck. I put my screenshots below, can you correct them for me?

Step1, I created a module in our package Dynasafe1, kept JS empty

Step2, I put the CSS in the LESS

 Step3, I created a replacing view model under Dynasafe1 package

Then I chose "Base schema - Detail with list" as the parent object.

And finally saved this replacing view model with JS kept empty. Did I miss something here?

 

Thank you for your answer in advance!

Andrew Sheng,

I got the answer! All I had left to do was to fill the JS code with:

 define("BaseGridDetailV2", ["css!UsrDynasafeDetailV2CSS"], function() {
	return {
		methods: {},
		diff: /**SCHEMA_DIFF*/[ ]/**SCHEMA_DIFF*/
	};
});

 

Show all comments

Hi Community,

Is there any possibility to put an image as a background in the Creatio Login Page ?

Example

Best regards,

Sasori

Like 0

Like

5 comments
Best reply

Hi Sasori,

 

It's possible, but proper css should be created:

what was done is adding the image to NuiLogin.aspx page css (add body elemnt there):

&lt;style&gt;
		.font-preload {
			position: absolute;
			opacity: 0;
		}
		.font-preload-open-sans {
			font-family: "Bpmonline Open Sans";
		}
		.font-preload-open-sans-light {
			font-family: "Bpmonline Open Sans Light";
		}
		.font-preload-open-sans-bold {
			font-family: "Bpmonline Open Sans Bold";
		}
		body {
			background-image: url("783px-Test-Logo.svg.png");
		}
	&lt;/style&gt;

and put this image to the root directory of app binary files. Only css should be modified in case you don't need to repeat this image and to set the size for it.

Hi Sasori,

 

It's possible, but proper css should be created:

what was done is adding the image to NuiLogin.aspx page css (add body elemnt there):

&lt;style&gt;
		.font-preload {
			position: absolute;
			opacity: 0;
		}
		.font-preload-open-sans {
			font-family: "Bpmonline Open Sans";
		}
		.font-preload-open-sans-light {
			font-family: "Bpmonline Open Sans Light";
		}
		.font-preload-open-sans-bold {
			font-family: "Bpmonline Open Sans Bold";
		}
		body {
			background-image: url("783px-Test-Logo.svg.png");
		}
	&lt;/style&gt;

and put this image to the root directory of app binary files. Only css should be modified in case you don't need to repeat this image and to set the size for it.

Oleg Drobina,

Thanks for the explanation Oleg, 

I tried all the steps but still the image is not showing in the background of the login page.

1- Modified NuiLogin.aspx file (path : inetpub\wwwroot\creatio\Login)

&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NuiLogin.aspx.cs" Inherits="Terrasoft.WebApp.Loader.Login.NuiLogin" %&gt;
 
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
 
&lt;html xmlns="http://www.w3.org/1999/xhtml" dir="&lt;%= PageDirection %&gt;" culture="&lt;%= LanguageCultureName %&gt;"&gt;
&lt;head runat="server"&gt;
	&lt;meta http-equiv="X-UA-Compatible" content="IE=Edge" /&gt;
	&lt;meta name="fontiran.com:license" content="LAXSN" /&gt;
	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
	&lt;title&gt;Creatio&lt;/title&gt;
	&lt;style&gt;
		.font-preload {
			position: absolute;
			opacity: 0;
		}
		.font-preload-open-sans {
			font-family: "Bpmonline Open Sans";
		}
		.font-preload-open-sans-light {
			font-family: "Bpmonline Open Sans Light";
		}
		.font-preload-open-sans-bold {
			font-family: "Bpmonline Open Sans Bold";
		}
		body {
			background-image: url("test.png");
		}
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div class="font-preload"&gt;
		&lt;span class="font-preload-open-sans"&gt;_&lt;/span&gt;
		&lt;span class="font-preload-open-sans-light"&gt;_&lt;/span&gt;
		&lt;span class="font-preload-open-sans-bold"&gt;_&lt;/span&gt;
	&lt;/div&gt;
	&lt;form id="IndexForm" runat="server"&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

1- Added test.png image file in ( path - inetpub\wwwroot\creatio\)

Sasori Oshigaki,

 

Strange, this approach worked in my local app perfectly. Maybe there is an error message in the console when trying to reach the Login page and it will provide more details? Or maybe the image is empty? Also try restarting the application in IIS.

Oleg Drobina,

Just fixed it Oleg

The mistake was the path of the image ( got it from console window)

The image should be placed under this path :

inetpub\wwwroot\creatio\Login

Thanks a lot for the help

Sasori

Sasori Oshigaki,

 

hm, in my case it requested the root directory of the app when I was testing it. Anyway, it's good that the console message answered the question!

Show all comments

Hello Everyone,



How can we add background color to a specific field in Record list. Please refer to the Screenshot i have attached. I want that status should change color as the value is also changes . ex. Status = Passed , then color should be green. if status = Failed then color should be Red. Please advise .

Like 0

Like

2 comments
Best reply

Weird, I had responded to this before, but now my response is gone. Anyway, I rewrote my response in an article showing how to do this for a Freedom UI list here: https://customerfx.com/article/adding-color-to-column-values-in-creatio…

Ryan

Weird, I had responded to this before, but now my response is gone. Anyway, I rewrote my response in an article showing how to do this for a Freedom UI list here: https://customerfx.com/article/adding-color-to-column-values-in-creatio…

Ryan

Ryan Farley,

 

Thanks Ryan 

 

Show all comments

Hello,

 

We have a boolean column in accounts section. If the value is checked, we would like to add an image on the header space as highlighted in yellow in image below. Is there a sample code/ recommendation for this?

 

Like 0

Like

1 comments

Hello,

You can write a simple button and display it in the center. 

{
				"operation": "insert",
				"name": "TestContainer",
				"parentName": "ActionButtonsContainer",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.CONTAINER,
					"wrapClass": ["test-container-wrapClass"],
					"items": []
				}
			},
            {
                "operation": "insert",
                "parentName": "TestContainer",
                "propertyName": "items",
                "name": "PrimaryContactButton",
                "values": {
 
                    "itemType": Terrasoft.ViewItemType.BUTTON,
                    "click": {bindTo: "testclick"},
					"visible": {bindTo: "checkVisible"},
                    "enabled": true,
                    "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
					"imageConfig": {"bindTo": "Resources.Images.EnrichedDefaultIcon"}
                }
            }

In the method checkVisible you can return true or false based on the condition.

To make it at the center just add a new CSS style:

define("AccountPageV2", ["css!UsrDStyle"], function() {

 

.test-container-wrapClass {

        margin-left: auto;

    margin-right: auto;

    width: 6em

    }

 

Show all comments

Hi community,

 

I have the following :

 

 

For example, the field "Bois de construction (CHF)" is on two lines. I want to have it only on one line like the field "Portes (CHF)".

 

Is it possible to do it in a CSS way ?

 

Many thanks,

Jonathan

Like 0

Like

2 comments

Hi Jonathan,

 

usually, you can use CSS styles in order to configure most of the fields you would like to.

 

We have already got a few requests from our users on a similar topic, so you can get familiarized with them by following the links:

 

https://community.creatio.com/articles/how-add-or-edit-css-style

 

https://community.creatio.com/questions/dropdownlookup-borders

 

Once you will need any further help, please, let us know.

 

Kind regards,

Gleb.

Jonathan,

To add the CSS to the page: https://customerfx.com/article/adding-custom-css-style-sheets-in-bpmonl…

You'll just need to play with the styles to get it to not wrap. Basically, you'll need to adjust the min-width of the div container of the label element (the div with class "label-wrap"), something like this:

div#UsrMyPagec61fd727-5004-4db7-b6a3-38ef6d467de8Container_Label {
    min-width: 20em;
}

Ryan

Show all comments

Hi,

I want to remove an element from a page (the LeftModuleContainer on the order page), I see the ID of the Div on the html using the 'F12' but I don't know where to find the html code. (the client module has the JS only...)

I think I'm missing a lot of information of how the code is stored in Creatio, can anyone explain me shortly how it works or if too difficult just explain how to get to the html and modify it?

Thanks

Like 0

Like

4 comments

Roman Rak,

Thank you.

I see how to ADD css but what if want to remove an element?

Roman Rak,

Thank you! I was able to remove.

Show all comments