I need the button that I created "Adjust Inventory" to be visible only when the page is not with altered fields without having the values saved.

So when it is unsaved it will show like this:

And when you have the "Save" and "Cancel" buttons visible, it should be disabled.

Like 0

Like

3 comments

Hi Gabriel,



Can you please check the SchemaPageV2 of your object?

That should have the Button definition in the Diff array and you can add the Visible: false property to it to remove it from your edit page.





BR,

Bhoobalan Palanivelu.

 

Bhoobalan Palanivelu,

I created an attribute to be able to disable it when there is an unsaved field, the problem is that I can't change it, and the page in the two images above are the same page, it is a detail page.

 

Gabriel Cassimiro,

 

Could you please share with us more details on the page/detail where you are using this, and the current code implementation that you have for your button?

 

Best regards,

Dariy

Show all comments

I need this button to be on all rows and not on "activeRowActions", and I can't find the right parent.

 

{
	"operation": "insert",
	"parentName": "DataGrid",
	"propertyName": "activeRowActions",
	"name": "MoveQtyButton",
	"values": {
		"itemType": Terrasoft.ViewItemType.BUTTON,
		"caption": "Move Qty",
		 "className": "Terrasoft.Button",
         "style":this.Terrasoft.controls.ButtonEnums.style.BLUE,
         "tag": "call",
	}
},

 

Like 1

Like

6 comments

Hi Gabriel,



Please find the solutions in the below community threads.

https://community.creatio.com/questions/add-button-datagrid-active-row
https://community.creatio.com/articles/add-button-active-row-detail







BR,

Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

Thanks for responding, but I had seen these posts before, and they helped me in parts but not for what I need, the two are for activeRow, that is for when they are selected only, and I need them to appear in all rows even if not selected.

Gabriel Cassimiro,



Thanks for the briefing!

In this case, you need a button as a column in the grid.



ContactSectionV2 Grid

define("ContactSectionV2", ["css!UsrContactSectionV2CSS"], function() {
	return {
		entitySchemaName: "Contact",
		attributes: {
			"SelectButtonColumn": {
				"dataValueType": Terrasoft.DataValueType.TEXT,
				"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN
			}
		},
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			onGridDataLoaded: function(response) {
				this.mixins.GridUtilities.onGridDataLoaded.call(this, response);
				this.addSelectCustomerButton();
			},
			onRender: function() {
				this.callParent(arguments);
				this.addSelectCustomerButton();
			},
			unSelectRow: function(id) {
				this.mixins.ConfigurationGridUtilities.unSelectRow.apply(this, arguments);
				this.addSelectCustomerButton();
			},
			addSelectCustomerButton: function() {
				var baseSelector = "#grid-ContactSectionV2DataGridGrid-wrap div.grid-listed-row div:last-child";
				var selector = baseSelector + ">span";
				var scope = this;
				$(selector).unbind();
				$(baseSelector).html(
					Ext.String.format("<span>{0}</span>", this.get("Resources.Strings.SelectCustomerButtonCaption")));
 
				$(selector).addClass("glb-select-customer-button");
 
				$(selector).click(function() {
					var id = "";
					try {
						id = arguments[0].currentTarget.offsetParent.offsetParent.attributes.id.value.split("item-")[1];
					} catch(e) {}
					if (id) {
						scope.onSelectCustomerButtonClick(id);
					} else {
						this.error("Active row id was not found");
					}
				});
			},
			onSelectCustomerButtonClick: function(id) {
				this.showInformationDialog(id);
			}
		}
	};
});

CSS Module:

.glb-select-customer-button {
	background: #8ecb60;
	color: white;
	padding: 2px 10px;
	border-radius: 3px;
}
 
.glb-select-customer-button:hover {
	background: #74bc48;
	cursor: pointer;
}



Result will be like below,





You need to do the same in your detail schema.





BR,

Bhoobalan Palanivelu.

 

Bhoobalan Palanivelu,

This is fantastic Bhoobalan, thanks for sharing!

Ryan

Bhoobalan Palanivelu,

Thanks, I have a question, because I'm trying to apply in a list of a detail, but I'm not having the same result for when it is a grid of a section, is there something I have to put different or does it work the same way?

Gabriel Cassimiro,



Please be informed to define the value for this label through the localizable string available on your schema page.

this.get("Resources.Strings.SelectCustomerButtonCaption"))

Also, you can check about the CSS and its dependency included in your schema.


 

BR,

Bhoobalan Palanivelu.

Show all comments

I am going to add custom button which alerts some text on contact page. Is it possible?

Like 0

Like

2 comments

Hello Muhammadjon,

 

in order to achieve this you need to create a Replacing view model at the Custom package.

For the partent object you will need to select ContactSectionV2, or the section where you want to create this button.

Then you need to create a new localizable string (you will see the possibility to create a new one on the left) where you will put the desired text. for the button. While creating the localizable string you will need to enter the value, and the code. The code is something that you will use later.

 

After that you insert this code on the page:

 define("ContactSectionV2",

        function(BaseFiltersGenerateModule, Enums, ConfigurationConstants, BusinessRuleModule) {

            return {

                entitySchemaName: "Contact",

                messages: {},

                attributes: {},

                rules: {}/**SCHEMA_MODULES*/,

                /**

                 * Current schema mixins

                 */

                mixins: {},

                methods: {

                    OnTestButtonClick : function() {

                        Terrasoft.showInformation('Test') 

                    }

                },

                diff: /**SCHEMA_DIFF*/[

                    {

                    "operation": "insert",

                    "parentName": "ActionButtonsContainer",

                    "propertyName": "items",

                    "name": "TestButton",

                    "values": {

                        "itemType": Terrasoft.ViewItemType.BUTTON,

                        "style": Terrasoft.controls.ButtonEnums.style.GREEN,

                        "caption": {"bindTo": "Resources.Strings.TestButtonCaption"},

                        "markerValue": {"bindTo": "QualificationProcessButtonCaption"},

                        "classes": {"wrapperClass": ["t-btn-wrapper t-btn-text t-btn-style-blue actions-button-margin-right"]},

                        "iconAlign": Terrasoft.controls.ButtonEnums.iconAlign.RIGHT,

                        "click": {"bindTo": "OnTestButtonClick"},

                        "layout": {

                            "column": 6,

                            "row": 0,

                            "colSpan": 2

                        },

                        "visible": true

                    }

                }    ]/**SCHEMA_DIFF*/

            };

        });

 

The method  Terrasoft.showInformation('Test')  is the one responsible for displaying the message on screen. Here instead of Test you can write any message. 

The part where it says "caption": {"bindTo": "Resources.Strings.TestButtonCaption"}" , this is where you put the code from the localizable string previously created. So if the code of the string was called TestButtonCaption, then you need to put Resources.Strings.TestButtonCaption. If you name the code like "RandomButton" then it will be Resources.Strings.RandomButton.

 

Best regards,

Dariy 

Thanks so much! This is so helpful

Dariy Pavlyk,

Show all comments

How can i create custom button which alerts some text?

Like 0

Like

1 comments

Hello Muhammadjon,

 

in order to achieve this you need to create a Replacing view model at the Custom package.

For the partent object you will need to select ContactSectionV2, or the section where you want to create this button.

Then you need to create a new localizable string (you will see the possibility to create a new one on the left) where you will put the desired text. for the button. While creating the localizable string you will need to enter the value, and the code. The code is something that you will use later.

 

After that you insert this code on the page:

 define("ContactSectionV2",

        function(BaseFiltersGenerateModule, Enums, ConfigurationConstants, BusinessRuleModule) {

            return {

                entitySchemaName: "Contact",

                messages: {},

                attributes: {},

                rules: {}/**SCHEMA_MODULES*/,

                /**

                 * Current schema mixins

                 */

                mixins: {},

                methods: {

                    OnTestButtonClick : function() {

                        Terrasoft.showInformation('Test') 

                    }

                },

                diff: /**SCHEMA_DIFF*/[

                    {

                    "operation": "insert",

                    "parentName": "ActionButtonsContainer",

                    "propertyName": "items",

                    "name": "TestButton",

                    "values": {

                        "itemType": Terrasoft.ViewItemType.BUTTON,

                        "style": Terrasoft.controls.ButtonEnums.style.GREEN,

                        "caption": {"bindTo": "Resources.Strings.TestButtonCaption"},

                        "markerValue": {"bindTo": "QualificationProcessButtonCaption"},

                        "classes": {"wrapperClass": ["t-btn-wrapper t-btn-text t-btn-style-blue actions-button-margin-right"]},

                        "iconAlign": Terrasoft.controls.ButtonEnums.iconAlign.RIGHT,

                        "click": {"bindTo": "OnTestButtonClick"},

                        "layout": {

                            "column": 6,

                            "row": 0,

                            "colSpan": 2

                        },

                        "visible": true

                    }

                }    ]/**SCHEMA_DIFF*/

            };

        });

 

The method  Terrasoft.showInformation('Test')  is the one responsible for displaying the message on screen. Here instead of Test you can write any message. 

The part where it says "caption": {"bindTo": "Resources.Strings.TestButtonCaption"}" , this is where you put the code from the localizable string previously created. So if the code of the string was called TestButtonCaption, then you need to put Resources.Strings.TestButtonCaption. If you name the code like "RandomButton" then it will be Resources.Strings.RandomButton.

 

Best regards,

Dariy 

Show all comments

Is there any way I can access a button instance directly, e.g., in the 'click' method of a client module in order to set the colour of the button using the setStyle method of the button object?

Like 0

Like

1 comments

Not sure if it's possible since setStyle only receives some value as an argument and is being executed when the button is initialized.

 

In your case I would recommend to add this code to the click handler:

var buttonElementToModify = document.getElementById("ContactPageV2ChangeContainerStateButtonButton-textEl");
				buttonElementToModify.style.backgroundColor = "Green";

and replace ContactPageV2ChangeContainerStateButtonButton-textEl with an actual id of the element in DOM:

As a result when the button is clicked its color will be changed to green.

 

Best regards,

Oscar

Show all comments

Hi community,

 

I try to trigger a business process from a custom button. I in the post that I need the ProcessModuleUtilities to achieve that. Here is my code :

 

define("MTF_Candidat1Page", ["MultiChoiceMixin", "ProcessModuleUtilities"], function(ProcessModuleUtilities) { 
	return {
		entitySchemaName: "MTF_Candidat",
		...
		methods: {
			OnClickCreateInterview: function(){
				var args = {
					sysProcessName: "MTFtestbtn" // this is the name of my business process. It simply send me a mail for now.
				};
				ProcessModuleUtilities.executeProcess(args);
 
				this.showInformationDialog("Busniess process triggered"); // just to show something to let me know the function triggered properly the busniess process
			},
		},
		...
		diff: /**SCHEMA_DIFF*/[
				...
				{
				"operation": "insert",
				"name": "BtnCreateInterview",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 7
					},
					"itemType": 5,
					"classes": {
						"textClass": [
							"actions-button-margin-right"
						],
						"wrapperClass": [
							"actions-button-margin-right"
						]
					},
					"click": {
						"bindTo": "OnClickCreateInterview"
					},
					"tag": "OnClickCreateInterview",
					"caption": {
						"bindTo": "Resources.Strings.BtnCreateInterviewCaption"
					},
					"hint": {
						"bindTo": "Resources.Strings.BtnCreateInterviewHint"
					}
				},
				"parentName": "ProfileContainer",
				"propertyName": "items",
				"index": 7
			}
			...
		]/**SCHEMA_DIFF*/
}

 

Now when I click on the button on my candidate page I have this error :

 

"Uncaught TypeError: ProcessModuleUtilities is undefined"

 

Do you have other docs to trigger business processes on custom button press ?

 

Best regards,

 

Julien

Like 0

Like

2 comments
Best reply

Hi Julien,

 

Could you change your schema definition as the following (swap "MultiChoiceMixin" and "ProcessModuleUtilities")?

define("MTF_Candidat1Page", ["ProcessModuleUtilities", "MultiChoiceMixin"], function(ProcessModuleUtilities) 

regards,

 

Cheng Gong

Hi Julien,

 

Could you change your schema definition as the following (swap "MultiChoiceMixin" and "ProcessModuleUtilities")?

define("MTF_Candidat1Page", ["ProcessModuleUtilities", "MultiChoiceMixin"], function(ProcessModuleUtilities) 

regards,

 

Cheng Gong

Cheng Gong,

 It works, thank you !

Show all comments

In a section edit page, we have created custom buttons and have functionalities to hide and show the button. If we refresh the page Button enable/ Disable are working fine

But once we open the edit page, the button visibily/ page opening are not working properly until we refresh the page

we tried  this.reloadEntity(); inside init:function(){} Method.

 

Please Suggest me how to solve this issue.

 

Like 0

Like

3 comments

Dear Mansoor,

 

Could you please create a case for our technical support indicating the issue and providing external access to the instance?



Thank you in advance,

Ivanna.

Ivanna Yatsura,

Dear Ivanna,

 

Yes I created the request for Creatio team (Request Id is:  #SR-01039215) 

Dear Ivanna,

 

Is there any update on this issue.

 

Thank you in advance,

Mansoor 

Show all comments

Hi,



I'm working on Activities right now and I created my own activity.

I wanted to insert a New Activity with a press of a button which is located in the MainHeader. Question, what's the best way to insert my own activity?



I am currently trying to insert it via custom web service through

Insert insert = new Insert(UserConnection)
                .Set("","")
                .Into("Activity")

I'm afraid there are events, computations that won't be triggered.



Any comments?

Like 0

Like

4 comments
Best reply

Solem Khan Abdusalam,

After you call activity.Save() you can get the created record Id using 

// get primary Id value
var id = activity.PrimaryColumnValue;
// or get any of the column values using 
var title = activity.GetTypedColumnValue<string>("Title");
var start = activity.GetTypedColumnValue<DateTime>("StartDate");
// etc

Ryan

Using the Insert class does not trigger process events, etc. Instead, you can use the Entity class. Something like this: 

var schema = UserConnection.EntitySchemaManager.GetInstanceByName("Activity");
// Create a new Activity object
var activity = schema.CreateEntity(UserConnection);
// Set any any default column values 
activity.SetDefColumnValues();
// Now set the column values as needed
activity.SetColumnValue("Title", "This is a new activity");
activity.SetColumnValue("StartDate", DateTime.Now);
// etc
// Save when done
activity.Save();

Hope this helps.

Ryan

Ryan Farley,



Is there a way to fetch the Id of the created Activity?

Solem Khan Abdusalam,

 

One of possible ways is to create a SELECT query to the database using or the script task process element (if you are going to use a business process) or in the custom web service that is triggered upon clicking the button and select the last created activity (top 1 and ORDER BY CreatedOn conditions). Also the created activity can have some marker in its subject (like "created via web service" or so) that could be used in the filtering condition as well.

 

Insert query you've proposed won't return an Id of the record, but you can select it once the record is created.

 

Best regards,

Oscar

Solem Khan Abdusalam,

After you call activity.Save() you can get the created record Id using 

// get primary Id value
var id = activity.PrimaryColumnValue;
// or get any of the column values using 
var title = activity.GetTypedColumnValue<string>("Title");
var start = activity.GetTypedColumnValue<DateTime>("StartDate");
// etc

Ryan

Show all comments

We need to add a custom button to the section analytical view page, which will trigger a business process.

 

 

Is it possible ?

Like 0

Like

3 comments

 This container you are referring to is supposed to store DataViews in it (please take a look at the getDefaultDataViews method from the BaseDataView module). It is not supposed to store buttons in it.

 

It is better to add the button to a separate container created in the FiltersContainer container and bind process execution to this button. As an example I've added the button to the contact section analytics data view:

define("ContactSectionV2", ["ProcessModuleUtilities"],
	function(ProcessModuleUtilities) {
		return {
			entitySchemaName: "Contact",
			attributes: {},
			messages: {},
			methods: {
				runCustomProcess: function() {
					var config = {
						sysProcessName: "UsrProcess_eedcaa6"
					};
					ProcessModuleUtilities.executeProcess(config);
				}
			},
			diff: /**SCHEMA_DIFF*/ [
				{
					"operation": "insert",
					"name": "CustomButtonContainer",
					"parentName": "FiltersContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.CONTAINER,
						"items": []
 
				},
				{
					"operation":"insert",
					"name": "TestProcessButton",
					"parentName": "CustomButtonContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": {bindTo: "Resources.Strings.CustomButtonCaption"},
						"click": {bindTo: "runCustomProcess"},
						"style": Terrasoft.controls.ButtonEnums.style.GREEN
					}
				}
				] /**SCHEMA_DIFF*/
		};
	});

And connected custom process execution when clicking the button. As a result the button appeared on the page as expected:

And a custom process was executed upon clicking it.

 

Best regards,

Oscar

Oleg Drobina,

Hi Oleg

 

Couple of questions. If I just wanted this button to appear on List View of the Section Page rather than the Analytics what would need to change?

 

Also does this code create the custom button here or does that need to be created elsewhere and it is just referenced here?

 

thanks

Rob Watson,

 

Hello Rob,

 

For the first question: I used the FiltersContainer container as a parent for the button, but it has the logic that it's hidden in the list view and is displayed only in analytics view (logic of the saveFiltersContainersVisibility method). In this case logic like this should be used:

methods: {
...
loadAnalyticsDataView: function() {
					this.set("IsCustomButtonContainerVisible", false);
					this.callParent(arguments);
				},
 
				loadGridDataView: function() {
					this.set("IsCustomButtonContainerVisible", true);
					this.callParent(arguments);
				},
...
 
diff: [
...
{
					"operation": "insert",
					"name": "CustomButtonContainer",
					"parentName": "QuickFilterModuleContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.CONTAINER,
						"visible": { "bindTo": "IsCustomButtonContainerVisible" },
						"items": []
					}
				},
				{
					"operation":"insert",
					"name": "TestProcessButton",
					"parentName": "CustomButtonContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": {bindTo: "Resources.Strings.CustomButtonCaption"},
						"click": {bindTo: "runCustomProcess"},
						"style": Terrasoft.controls.ButtonEnums.style.GREEN
					}
				}
...
]

We change a parent item for the "CustomButtonContainer" to "QuickFilterModuleContainer". As a result button will be visible only in list view and will be hidden in analytics view.

 

As for the second quesion: the button is created in the schema diff directly (container + button itself).

Show all comments

After custom section button processing in list view mode, I need to switch to analytics view, instead of returning and waiting for the user to click on the analytics view button.

Is it possible ?

Like 0

Like

4 comments
Best reply

Ricardo Bigio,

You can use the following code to change to the dashboard view in a section:

this.changeDataView(this.get("AnalyticsDataViewName"));

Ryan

Hello Ricardo,

 

Can you please provide us with more details regarding your request and the business task you are trying to achieve?

I suppose you have some custom section with records and after you open a record and click some button on the page, you want the system to open section Dashboards instead of the regular section record list, am I correct?

 

Thank you!

 

Best regards,

Bogdan S.

On the section page are the buttons "new", "actions" , and the ones that switch from list mode to analytic mode.

Besides them,  I have a custom button,  "I/S",  that triggers a business process (in order to build data that will be shown when the user switches to analytic mode) and returns to the section page. Upon return, the section page will be in list mode, as it was before. What I need is the code in the section button processing to return to the section page already in analytic mode, so that the user will not have to click on the analytic mode icon in order to view the data.

 

Ricardo Bigio,

You can use the following code to change to the dashboard view in a section:

this.changeDataView(this.get("AnalyticsDataViewName"));

Ryan

Perfect. Thanks !

Show all comments