i need to disable a button after it is clicked once without refreshing a page.

Like 0

Like

1 comments

Add a boolean attribute to the page:

attributes: {
    "IsButtonEnabled": {
		dataValueType: Terrasoft.DataValueType.BOOLEAN,
		type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
		value: true
	}
}

Then bind the enabled property of the button to the attribute:

{
	"operation": "insert",
	"parentName": "Header",
	"propertyName": "items",
	"name": "MyButton",
	"values": {
		"itemType": Terrasoft.ViewItemType.BUTTON,
		"caption": "My button",
		"click": {"bindTo": "onMyButtonClick"},
		"enabled": {"bindTo": "IsButtonEnabled"}
	}
}

Now when it is clicked, set the attribute to false:

onMyButtonClick: function() {
    this.set("IsButtonEnabled", false);
}

Ryan

Show all comments

Hello Community!

I want to save a record on button click. How is this done from the front-end. What is the line of code that I am missing. Best Regards!

Like 0

Like

6 comments
Best reply

Petrika,

 

It doesn't save the record since the click event is handled not by the onCardAction method, but by your custom one:

click": {
						"bindTo": "onGenerateReferencePriceClick"
					},

According to your need you can use another approach of saving a record: you can call the save function directly (save method parent implementation can be found in the BaseEntityPage module):

this.save();

just add it at the beginning of the code for your button click handling.  And also you can execute methods synchronously using Terrasoft.chain method (an example of the usage can be found in this community post).

 

Best regards,

Oscar

Hi Petrika,

 

Please study the logic of the SaveRecordButton element in the BaseDataView module and the logic of the onCardAction method and the "save" tag of the button and apply the same logic to your button.

 

Best regards,

Oscar

Oscar Dylan,

Dear Oscar!

I have added the save tag , in the button diff ( image below )

I am uncertain of the lines of code I have to put in the body of the Method, that the button calls(image below)

Your help is much appreciated Oscar! Thank you

Petrika,

 

Simply add:

"tag": "save",
"markerValue": "SaveButton",
...
"click": {
						"bindTo": "onCardAction"
					}

To your button "values" and refresh the page. This will do the trick.

 

Best regards,

Oscar

Oscar,

Still Its not working.

I will give a full explanation of the problem.

I have created a button Generate Reference Price (marked with Red), which calls a web-service that populates the Collateral Price indicator detail(marked with yellow).

In the moment That I click the Generate Reference Price button i want that the information entered in the page is saved (just like clicking the Save button marked with brown). You can get a better understanding from the image below.

This is the code from the button

"operation": "insert",
				"name": "FzGeneratePrecalButton",
				"values": {
					"itemType": 5,
					"style": "blue",
					"id": "74a20850-7021-4e0a-a2e6-98bdc419f323",
					"tag": "save",
					"markerValue": "SaveButton",
					"caption": "Generate Reference Price",
                     ...
					"click": {
						"bindTo": "onGenerateReferencePriceClick"
					},
					"visible": {
						"bindTo": "FZButtonVisible"
					},
					"enabled": true
				},

And this is part of the code, of the Method that the button calls

onGenerateReferencePriceClick: function()
			{
				const tag = arguments[0] || arguments[3];
				const cardModuleSandboxId = this.getCardModuleSandboxId();
				this.sandbox.publish("onGenerateReferencePriceClick", tag, [cardModuleSandboxId]);

This is the result from the debugger

I cant find a reaon why this is not working.

Petrika,

 

It doesn't save the record since the click event is handled not by the onCardAction method, but by your custom one:

click": {
						"bindTo": "onGenerateReferencePriceClick"
					},

According to your need you can use another approach of saving a record: you can call the save function directly (save method parent implementation can be found in the BaseEntityPage module):

this.save();

just add it at the beginning of the code for your button click handling.  And also you can execute methods synchronously using Terrasoft.chain method (an example of the usage can be found in this community post).

 

Best regards,

Oscar

Thanks very much Oscar!

Show all comments
Question

Hello Community,

Is it possible to hide a button that I created myself through business rules (

Show element on the page)? I want the button to appear when some fields of my page are filled in. How is this done ?

Like 0

Like

3 comments

Hello Petrika,

 

Thank you for your question!

 

Unfortunately, it's not possible to hide a button with the help of a business rule. You can only hide a field.

 

Kind regards,

Anastasiia

Hello Anastasia!

I thought that Attribute, could help me in this scenario

 

Hello Petrika,

 

There was a similar question on the Community in the past. Please see this thread. In your case the ButtonVisible attribute should change the state from true to false and visa versa in case this.get("Needed column")=="" or typeof(this.get("Needed column")) == 'undefined'. So simply perform a couple of tests and you will get the result needed.

 

Best regards,

Oscar

Show all comments

Hello Community!

I am developing a functionality such as, a data grid within a detail, is populated when I Click a button. In the same time when I click the button I want to reload the grid data. Which is the proper syntax for the callback function in Creatio, because i havent seen many examples in the Community.

 
			onGenerateButtonClick: function(callback,scope)
			{
				var currentRecordId = this.get("MasterRecordId");
				var args = {
                    sysProcessName: "FZProcess_dc5a9de",
                    parameters: {
                        RecordId: currentRecordId,
						Amount: FZAmount,
						Interes: FZInteres,
						StartPaymentDate: FZStartPaymentDate,
						Tenor: FZTenor		
                    } 		
                }                
				this.reloadGridData();
                ProcessModuleUtilities.executeProcess(args);  
 
			}

I want to use this.reloadGridData(); inside a callback, after the   ProcessModuleUtilities.executeProcess(args) is finished , which is the proper way to do this ? 

Like 0

Like

6 comments
Best reply

Petrika,

In your case the button appears to be a part of the page schema, not a part of the detail schema. For you to refresh the detail you'd need to use:

this.updateDetail({ detail: "NameOfDetail" });

You can find the "NameOfDetail" value to use by looking at the details section of the page code for your detail (it's not the name of the detail schema, but the name or Id it gave it when it added it to the page). The reloadGridData function only works from within the detail schema code itself. 

Hello Petrika,

Calling this.reloadGridData() is the proper function to use to refresh the detail grid from within the detail schema itself. However, you do need to call after the process completes. 

I have an article here that shows how to use a callback when executing a process: https://customerfx.com/article/programmatically-starting-a-process-from…

If you put the call to reloadGridData inside the callback then it will refresh  when the process has completed.

Ryan

Ryan Farley,

Hello Ryan,

Firstly thanks for the quick reply, your posts are very useful, each time i have a developing problem in creatio.

In this case i saw the post before. I have try it. When I use the callback like the article the page only reloads and never stops, thats why i thought of another callback syntax.

Ryan Farley,

To be more specific

I have created this button Generate on the Main Page(parent). When this button is clicked , it calls a bussines Process, which on the other hand executes a Stored Procedure(populates dhe datagrid of the details).

onGeneratePrecalButtonClick: function()
			{
var currentRecordId = this.get("Id");
		var args = {                                                                  
		sysProcessName: "FZProcess_dc5a9de",
			parameters: {
				RecordId: currentRecordId,
				Amount: this.$FZAmount,
				Interes: this.$FZInteres,
				StartPaymentDate: this.$FZStartPaymentDate,
				Tenor: this.$FZTenor		
					}
				};
              ProcessModuleUtilities.executeProcess(args);  
}

When the Business Process finishes, i want to reload the grid data of the Details, so that I dont have to press the green Button below

How can this be done ?

 

Petrika,

 

Hello,

 

There are two possible ways:

 

1) Call this method after the executeProcess method call:

this.updateDetail({
 
                        detail: "DetailNameHere"
 
                    });

2) At the end of your business process execution you need to send some message using MsgChannelUtilities class and PostMessageToAll method, create a replacing ClientMessageBridge, add your message there, add the message to the page where the detail is located, subscribe to the message and specify a handler for the received message (a simple example is here). Once the message is received the handler should call the same updateDetail method as above.

 

Best regards.

Oscar

Petrika,

In your case the button appears to be a part of the page schema, not a part of the detail schema. For you to refresh the detail you'd need to use:

this.updateDetail({ detail: "NameOfDetail" });

You can find the "NameOfDetail" value to use by looking at the details section of the page code for your detail (it's not the name of the detail schema, but the name or Id it gave it when it added it to the page). The reloadGridData function only works from within the detail schema code itself. 

Thanks very much Oscar and Ryan ! Your help was great.

Show all comments

Hi community,

 

I have the following situation :

 

 

From the "ENCOWAY SESSION" button, I want to override the onClick() method from it to automatically start a business process from there. How can I do this ?

 

 

Furthermore, my business process should take the object id (e.g. opportunity id) corresponding to the id of the record where the button is and set it as a request parameter of a webservice.

 

Then, I want to open the response paramter, which is an URL, in a new window. The Script Task is in C#, so I want to have a similar method as window.open("URL") in Javascript. The "URL" should be the response parameter of the API.

 

Do you have any idea on how to achieve this ?

 

Here is a business process model summary of what I want :

 

 

Many thanks,

Jonathan

Like 0

Like

2 comments
Best reply

Hi Jonathan,

I have an article on that topic with the code you'll need to start the process and pass the current record Id into a process parameter here: https://customerfx.com/article/programmatically-starting-a-process-from…

However, as far as opening a new window, you can't do that from a server-side process. Instead, you can send a value, such as a URL string, from the server-side process to the client-side code, then the client-side code could open the window. I have an article on that topic here https://customerfx.com/article/sending-a-message-from-server-side-c-to-…

Ryan

Hi Jonathan,

I have an article on that topic with the code you'll need to start the process and pass the current record Id into a process parameter here: https://customerfx.com/article/programmatically-starting-a-process-from…

However, as far as opening a new window, you can't do that from a server-side process. Instead, you can send a value, such as a URL string, from the server-side process to the client-side code, then the client-side code could open the window. I have an article on that topic here https://customerfx.com/article/sending-a-message-from-server-side-c-to-…

Ryan

Dear Ryan Farley,

 

Your answer was really perfect. I managed to implement the whole process. Your articles are very pertinent. 

 

Many many thanks,

Jonathan

Show all comments

Hi 

Can anyone tell me what is the functionality of the Portal message button (as highlighted in the image) present in the Cases section on portal, and where can I find its configuration in the system?

 

Thanks

Like 0

Like

3 comments

Hello Nisarg,



Could you please elaborate more on your business task?



Best regards,

Bogdan

Hi Bogdan,

As the Cases section is not present in Studio Creatio, I would want to implement the Portal message button functionality in a custom section.

Thanks

Dear Nisarg,



Unfortunately, there is no way to implement your business task.



Best regards,

Bogdan

Show all comments

Hi community,

 

I try to trigger a business process that take one argument when I click on a button. When I click on my button the pop-up (as defined in my code below) shows up but I have an error via the console in chrome dev tools.

 

Here is the error that occurs (XML parse error: not well formatted):

 

Here is my schema :

define("ContactSectionV2", ["ProcessModuleUtilities", "ContactSectionV2Resources"], function(ProcessModuleUtilities, resources) {
	return {
		entitySchemaName: "Contact",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "BtnCreateCandidat",
				"parentName": "CombinedModeActionButtonsCardLeftContainer",
				"propertyName": "items",
				"values": {
					itemType: Terrasoft.ViewItemType.BUTTON,
					style: Terrasoft.controls.ButtonEnums.style.BLUE,
					classes: {
						"textClass": ["actions-button-margin-right"],
						"wrapperClass": ["actions-button-margin-right"]
					},
					click: { bindTo: "OnClickCreateCandidat" },
					tag: "CombinedModeActionButtonsCardLeftContainer",
					caption: { bindTo: "Resources.Strings.BtnCreateCandidatCaption" },
					hint: { bindTo: "Resources.Strings.BtnCreateCandidatHint" },
					enabled: true,
				},
			},
		]/**SCHEMA_DIFF*/,
		methods: {
			OnClickCreateCandidat: function(){
				var contactId = this.getActiveRow().get("Id");
				var args = {
					parameters: {
                        ProcessSchemaContactStr: contactId
                    },
					sysProcessName: "MTF_CreateCandidatIfNotExists",
					callback: function(){
						this.showInformationDialog(contactId);
						return true;
					},
					// scope: this
				};
				ProcessModuleUtilities.executeProcess(args);
				return true;
			},
		}
	};
});

And here is my business process :

 

It takes one argument as input :

 

"parse contactId" is a simple line to transform a string to a Guid :

Guid.Parse([#ContactStr#])

and I set the value returned to the ContactId argument.

 

then I try to read a candidate with the Contact Guid that I just set (a Candidate has a lookup field to a Contact object).

 

It just check if the candidate was found, if not it will create it. The BP returns the Candidate Guid.

 

The business process runs, the Candidate object is created (empty for some reason, not even with the Contact lookup filled) each it needs but I always have the XML parse error.

 

Do you know how can I debut this and how can I resolve this ?

 

Best regards,

 

Julien G.

Like 0

Like

7 comments

Hello Julien,

 

Please find this request in the network tab of the browser and send the complete response to this request. Also what is being written in the server logs?

 

Best regards,

Oscar 

Oscar Dylan,

 

The button send a POST request.

Request (json) :

{
  "collectExecutionData": true,
  "parameterValues": [
    {
      "name": "ProcessSchemaContactStr",
      "value": "afbdee02-d829-4cd6-aef9-74c719e3d169"
    }
  ],
  "schemaName": "MTF_CreateCandidatIfNotExists",
  "resultParameterNames": []
}

and the response (json) :

{
  "processId": "a78bff89-c553-43bc-9d3a-210302be2c25",
  "processStatus": 2,
  "resultParameterValues": null,
  "executionData": null,
  "success": true,
  "errorInfo": null
}

Here is the IIS log when I click my button :

(I replaced Creatio's IP, Creatio's FQDN and my IP address)

2021-10-27 08:30:42 CreatioFQDN POST /0/ServiceModel/ProcessEngineService.svc/RunProcess - 443 julien.gunther myIPAddress Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:93.0)+Gecko/20100101+Firefox/93.0 https://CreatioFQDN/0/Nui/ViewModule.aspx 200 0 0 624

I don't have any other logs..

Julien Gunther,

 

This error somehow prevents the data from saving or something is not working in the system when you receive this error to the client-side? If not, please ignore it.

 

Best regards,

Oscar

Oscar Dylan,

This prevents the data from being saved correctly. The newly created object is saved but it is an empty object. No data is saved in the saved object.

 

Another problem is that when I click on this button, a pop-up window appears with the Guid of the selected contact (as specified in the section diagram), then it loads indefinitely. The only way to get out of this state is to reload the page.

 

Best regards,

 

Julien

Julien Gunther,

 

Issues like this are not possible to be solved in the community. Please share the backup of the app if this is deployed locally and provide steps to reproduce the problem in the email sent to support@creatio.com and I will take a look.

 

Best regards,

Oscar

Julien Gunther,



Could you go to the process library, select your business process and click the property. In the open page, check the "Trace enabled" option. 

 

After that, you can find the trace log in the business process log. From there, you can check what is the parameter value and if the value is correct or not before/after the certain step.

 

According to what you described, it sounds like the contactId parameter is not setup correctly. So it is important to ensure the contactId after your Guid.Parse is correct.

 

On the other hand, have tried to set the contactId directly from button click scripts?

 

regards,

 

Cheng Gong

Cheng Gong,

 

Sorry for my late reply,



I checked the trace, the contactId has been defined successfully. I have no trace for the formulas, only for "Create Candidate" and "Try Read Candidate".

 

Try Read Candidat trace :

{
	"Paramètres de l'élément": [
		{
			"Paramètre": "Sources de données des filtres",
			"Valeur": {
				"Avant exécution": "{\"className\":\"Terrasoft.FilterGroup\",\"serializedFilterEditData\":\"{\\\"className\\\":\\\"Terrasoft.FilterGroup\\\",\\\"items\\\":{\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\":{\\\"className\\\":\\\"Terrasoft.InFilter\\\",\\\"filterType\\\":4,\\\"comparisonType\\\":3,\\\"isEnabled\\\":true,\\\"trimDateTimeParameterToDate\\\":false,\\\"leftExpression\\\":{\\\"className\\\":\\\"Terrasoft.ColumnExpression\\\",\\\"expressionType\\\":0,\\\"columnPath\\\":\\\"MTFContactCandidat\\\"},\\\"isAggregative\\\":false,\\\"key\\\":\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\",\\\"dataValueType\\\":10,\\\"leftExpressionCaption\\\":\\\"Candidat\\\",\\\"referenceSchemaName\\\":\\\"Contact\\\",\\\"rightExpressions\\\":[{\\\"className\\\":\\\"Terrasoft.ParameterExpression\\\",\\\"expressionType\\\":2,\\\"parameter\\\":{\\\"className\\\":\\\"Terrasoft.Parameter\\\",\\\"dataValueType\\\":26,\\\"value\\\":{\\\"value\\\":\\\"[IsOwnerSchema:false].[IsSchema:false].[Parameter:{e8e60615-91be-40a0-a225-2922d2a98f23}]\\\",\\\"displayValue\\\":\\\"ContactId\\\",\\\"Id\\\":\\\"e2c00489-34d4-4d18-a703-39f3c30e7543\\\"}}}]}},\\\"logicalOperation\\\":0,\\\"isEnabled\\\":true,\\\"filterType\\\":6,\\\"rootSchemaName\\\":\\\"MTF_Candidat\\\",\\\"key\\\":\\\"\\\"}\",\"dataSourceFilters\":\"{\\\"items\\\":{\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\":{\\\"filterType\\\":4,\\\"comparisonType\\\":3,\\\"isEnabled\\\":true,\\\"trimDateTimeParameterToDate\\\":false,\\\"leftExpression\\\":{\\\"expressionType\\\":0,\\\"columnPath\\\":\\\"MTFContactCandidat\\\"},\\\"rightExpressions\\\":[{\\\"expressionType\\\":2,\\\"parameter\\\":{\\\"dataValueType\\\":26,\\\"value\\\":{\\\"value\\\":\\\"[IsOwnerSchema:false].[IsSchema:false].[Parameter:{e8e60615-91be-40a0-a225-2922d2a98f23}]\\\",\\\"Id\\\":\\\"e2c00489-34d4-4d18-a703-39f3c30e7543\\\"}}}]}},\\\"logicalOperation\\\":0,\\\"isEnabled\\\":true,\\\"filterType\\\":6,\\\"rootSchemaName\\\":\\\"MTF_Candidat\\\"}\"}",
				"Après exécution": "{\"className\":\"Terrasoft.FilterGroup\",\"serializedFilterEditData\":\"{\\\"className\\\":\\\"Terrasoft.FilterGroup\\\",\\\"items\\\":{\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\":{\\\"className\\\":\\\"Terrasoft.InFilter\\\",\\\"filterType\\\":4,\\\"comparisonType\\\":3,\\\"isEnabled\\\":true,\\\"trimDateTimeParameterToDate\\\":false,\\\"leftExpression\\\":{\\\"className\\\":\\\"Terrasoft.ColumnExpression\\\",\\\"expressionType\\\":0,\\\"columnPath\\\":\\\"MTFContactCandidat\\\"},\\\"isAggregative\\\":false,\\\"key\\\":\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\",\\\"dataValueType\\\":10,\\\"leftExpressionCaption\\\":\\\"Candidat\\\",\\\"referenceSchemaName\\\":\\\"Contact\\\",\\\"rightExpressions\\\":[{\\\"className\\\":\\\"Terrasoft.ParameterExpression\\\",\\\"expressionType\\\":2,\\\"parameter\\\":{\\\"className\\\":\\\"Terrasoft.Parameter\\\",\\\"dataValueType\\\":26,\\\"value\\\":{\\\"value\\\":\\\"[IsOwnerSchema:false].[IsSchema:false].[Parameter:{e8e60615-91be-40a0-a225-2922d2a98f23}]\\\",\\\"displayValue\\\":\\\"ContactId\\\",\\\"Id\\\":\\\"e2c00489-34d4-4d18-a703-39f3c30e7543\\\"}}}]}},\\\"logicalOperation\\\":0,\\\"isEnabled\\\":true,\\\"filterType\\\":6,\\\"rootSchemaName\\\":\\\"MTF_Candidat\\\",\\\"key\\\":\\\"\\\"}\",\"dataSourceFilters\":\"{\\\"items\\\":{\\\"c46e04a9-f961-4607-8585-9eb58c49d628\\\":{\\\"filterType\\\":4,\\\"comparisonType\\\":3,\\\"isEnabled\\\":true,\\\"trimDateTimeParameterToDate\\\":false,\\\"leftExpression\\\":{\\\"expressionType\\\":0,\\\"columnPath\\\":\\\"MTFContactCandidat\\\"},\\\"rightExpressions\\\":[{\\\"expressionType\\\":2,\\\"parameter\\\":{\\\"dataValueType\\\":26,\\\"value\\\":{\\\"value\\\":\\\"[IsOwnerSchema:false].[IsSchema:false].[Parameter:{e8e60615-91be-40a0-a225-2922d2a98f23}]\\\",\\\"Id\\\":\\\"e2c00489-34d4-4d18-a703-39f3c30e7543\\\"}}}]}},\\\"logicalOperation\\\":0,\\\"isEnabled\\\":true,\\\"filterType\\\":6,\\\"rootSchemaName\\\":\\\"MTF_Candidat\\\"}\"}"
			}
		},
		{
			"Paramètre": "Lire d'abord",
			"Valeur": {
				"Avant exécution": true,
				"Après exécution": true
			}
		},
		{
			"Paramètre": "Ordre des colonnes",
			"Valeur": {
				"Avant exécution": "Name:1:1",
				"Après exécution": "Name:1:1"
			}
		},
		{
			"Paramètre": "Premier élément de la collection résultante",
			"Valeur": {
				"Avant exécution": {},
				"Après exécution": {}
			}
		},
		{
			"Paramètre": "Lire les données non validées",
			"Valeur": {
				"Avant exécution": true,
				"Après exécution": true
			}
		},
		{
			"Paramètre": "Considérez l'heure dans le filtre",
			"Valeur": {
				"Avant exécution": true,
				"Après exécution": true
			}
		}
	],
	"Paramètres du processus": [
		{
			"Paramètre": "Candidat",
			"Valeur": {
				"Avant exécution": "00000000-0000-0000-0000-000000000000",
				"Après exécution": "00000000-0000-0000-0000-000000000000"
			}
		},
		{
			"Paramètre": "ContactId",
			"Valeur": {
				"Avant exécution": "42a4317d-1712-41b2-994c-11b6fc64b199",
				"Après exécution": "42a4317d-1712-41b2-994c-11b6fc64b199"
			}
		},
		{
			"Paramètre": "ContactStr",
			"Valeur": {
				"Avant exécution": "42a4317d-1712-41b2-994c-11b6fc64b199",
				"Après exécution": "42a4317d-1712-41b2-994c-11b6fc64b199"
			}
		}
	]
}

 

Create Candidat Trace :

{
	"Paramètres de l'élément": [
		{
			"Paramètre": "Objet",
			"Valeur": {
				"Avant exécution": "106e3cde-5534-4cac-a87d-37c23359b9ef",
				"Après exécution": "106e3cde-5534-4cac-a87d-37c23359b9ef"
			}
		},
		{
			"Paramètre": "Filtres des sources de données",
			"Valeur": {
				"Avant exécution": "",
				"Après exécution": ""
			}
		},
		{
			"Paramètre": "Module d'ajout d'enregistrement",
			"Valeur": {
				"Avant exécution": "0",
				"Après exécution": "0"
			}
		},
		{
			"Paramètre": "Objet",
			"Valeur": {
				"Avant exécution": "00000000-0000-0000-0000-000000000000",
				"Après exécution": "00000000-0000-0000-0000-000000000000"
			}
		},
		{
			"Paramètre": "Définir la valeur des colonnes",
			"Valeur": {
				"Avant exécution": {
					"Values": {
						"b8993e82-0840-410a-82a7-386a3295755c": "00000000-0000-0000-0000-000000000000"
					},
					"FetchMetaPathes": {}
				},
				"Après exécution": {
					"Values": {
						"b8993e82-0840-410a-82a7-386a3295755c": "00000000-0000-0000-0000-000000000000"
					},
					"FetchMetaPathes": {}
				}
			}
		},
		{
			"Paramètre": "L'Id de l'enregistrement a été créé",
			"Valeur": {
				"Avant exécution": "00000000-0000-0000-0000-000000000000",
				"Après exécution": "3bb08bf6-abc8-4385-9b99-957c2aaa6d8c"
			}
		},
		{
			"Paramètre": "Considérez l'heure dans le filtre",
			"Valeur": {
				"Avant exécution": true,
				"Après exécution": true
			}
		}
	],
	"Paramètres du processus": [
		{
			"Paramètre": "Candidat",
			"Valeur": {
				"Avant exécution": "00000000-0000-0000-0000-000000000000",
				"Après exécution": "00000000-0000-0000-0000-000000000000"
			}
		},
		{
			"Paramètre": "ContactId",
			"Valeur": {
				"Avant exécution": "42a4317d-1712-41b2-994c-11b6fc64b199",
				"Après exécution": "42a4317d-1712-41b2-994c-11b6fc64b199"
			}
		},
		{
			"Paramètre": "ContactStr",
			"Valeur": {
				"Avant exécution": "42a4317d-1712-41b2-994c-11b6fc64b199",
				"Après exécution": "42a4317d-1712-41b2-994c-11b6fc64b199"
			}
		}
	]
}

 

As you can see, the ContactStr parameter was successfully parsed into a Guid object.



I have no errors and, according to the trace, my Candidate object was created successfully.



When I click on the button, it gives me the contact ID in a string, that's why I had to convert it into a Guid.



Best regards,



Julien

Show all comments

Hi community,

 

I'd like to add button on a active row in a data grid :

 

For that I found posts on the community that explain how to achieve that :

https://community.creatio.com/questions/alteradd-row-buttons-newly-crea…

https://community.creatio.com/questions/add-button-row-section

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

https://community.creatio.com/questions/override-section-open-record-bu…

 

I tried to follow them. Here is my code :

define("ContactSectionV2", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
	return {
		entitySchemaName: "Contact",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "BtnRowCreateCandidature",
				"parentName": "DataGrid",
				"propertyName": "activeRowActions",
				"values": {
					"className": "Terrasoft.Button",
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					"tag": "DataGridCandidature",
					"caption": { "bindTo": "Resources.Strings.BtnRowCreateCandidatureCaption" },
					"hint": { "bindTo": "Resources.Strings.BtnCreateCandidatureHint" },
				}
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue){
				this.callParent(arguments);
				switch(buttonTag){
					case "DataGridCandidature":
						this.myCustomFunction(primaryColumnValue);
						break;
				}
			},
			myCustomFunction: function(primaryColumnValue){
				this.showInformationDialog(primaryColumnValue);
			},
		}
	};
});

But for some reasons, the newly created button never showed up.

Is this the right way to create a button in a datagrid row ?

 

Best regards,

 

Julien Gunther

Like 1

Like

2 comments
Best reply

Hello Julien,

 

I've used the following approach:

define("ContactSectionV2", ["ContactSectionV2Resources"], function(resources) {
	return {
		entitySchemaName: "Contact",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
        		"operation": "insert",
        		"name": "DataGridActiveRowTestButtonAdding",
				"parentName": "DataGrid",
				"propertyName": "activeRowActions",
        		"values": {
                                "className": "Terrasoft.Button",
                                "style":this.Terrasoft.controls.ButtonEnums.style.BLUE,
                                "markerValue": "TestButtonAddingAction",
                                "tag": "call",
                                "caption": resources.localizableStrings.TestButtonAddingRowButtonCaption
        		}
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue) {
				switch (buttonTag) {
					case "call":
						this.testClick(primaryColumnValue);
						break;
					default:
						this.callParent(arguments);
						break;
				}
			},
			testClick: function(recordId) {
				this.console.log("The button is clicked!");
			}
		}
	};
});

Using localizable resources of the schema. It seems that in your code the module doesn't load the localizable string for "BtnRowCreateCandidatureCaption" key. In my code the string value was loaded and the button is present in active row:

Best regards,

Oscar

Hello Julien,

 

I've used the following approach:

define("ContactSectionV2", ["ContactSectionV2Resources"], function(resources) {
	return {
		entitySchemaName: "Contact",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
        		"operation": "insert",
        		"name": "DataGridActiveRowTestButtonAdding",
				"parentName": "DataGrid",
				"propertyName": "activeRowActions",
        		"values": {
                                "className": "Terrasoft.Button",
                                "style":this.Terrasoft.controls.ButtonEnums.style.BLUE,
                                "markerValue": "TestButtonAddingAction",
                                "tag": "call",
                                "caption": resources.localizableStrings.TestButtonAddingRowButtonCaption
        		}
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue) {
				switch (buttonTag) {
					case "call":
						this.testClick(primaryColumnValue);
						break;
					default:
						this.callParent(arguments);
						break;
				}
			},
			testClick: function(recordId) {
				this.console.log("The button is clicked!");
			}
		}
	};
});

Using localizable resources of the schema. It seems that in your code the module doesn't load the localizable string for "BtnRowCreateCandidatureCaption" key. In my code the string value was loaded and the button is present in active row:

Best regards,

Oscar

Oscar Dylan,

 Thank you very much it works !

Show all comments

Hi Team,



I would like to apply the "enabled" property to active row buttons COPY & DELETE in  contact section.



 

I have tried the below code but it doesn't work.

{
		"operation": "merge",
		"name": "DataGridActiveRowCopyAction",
		"values": {
		//"enabled": {bindTo: "ShowButtonforAdmin"},
		"enabled": false,
		}
},
{
		"operation": "merge",
		"name": "DataGridActiveRowDeleteAction",
		"values": {
		//"enabled": {bindTo: "ShowButtonforAdmin"},
		"enabled": false,
		}
},

 

 

Kindly guide me to achieve the Enable/Disable operation in active row buttons of contact section (COPY & DELETE).



Thanks in advance!

 

 

 

Best Regards,

Bhoobalan P.

Like 0

Like

4 comments

Hi Bhoobalan, 

 

please use "visible" : false

 

instead of 

"enabled": false

and the button will be hidden.

 

Best Regards, 

 

Bogdan L.

Bogdan Lesyk,



Thanks much for the response!



Yes, I have tried with visible and its working but I wanted to Disable the button for few users. The button should be displayed and disabled.





Could you please guide on achieving it?

Bhoobalan Palanivelu,

 

I'm not sure that it's possible and we don't have practical examples of such implementation using js code.

 

However, the best way to achieve it will be setting up the Object permission, it will be much easier for you and best in terms of implementation: 

 

 

Regards, 

 

Bogdan L.

 

Bogdan Lesyk,



Thanks, This OBJECT permission is OOTB and it works.

I tried to depict the button to user as disabled and to inform/give an idea as that this button is not available to click.



Thanks,

Bhoobalan P.

Show all comments

Hi, community.

 

When you click an activity on the calendar page, you get this mini page where you can complete the activity or cancel it. I need to remove the "cancel activity" button highlighted here in red:

 

I figure I can use the remove operation like in this example:


 
diff: 
/**SCHEMA_DIFF*/[ 
{ "operation": "remove", "name": "CopyButton" }, 
{ "operation": "remove", "name": "DeleteButton" }, 
{ "operation": "remove", "name": "OpenButton" } }

 

But I can't find  the schema I have to modify.... Does anyone know which one it is?

 

Thanks!

Like 1

Like

2 comments
Best reply

Hello,

 

It is ActivityMiniPage of UIv2 package. You need to re-define the insert operation of CancelButton

Regards,

Dean

Hello,

 

It is ActivityMiniPage of UIv2 package. You need to re-define the insert operation of CancelButton

Regards,

Dean

dean parrett, Thank you very much for your answer! It works as intended.

Cheers from Mexico

Show all comments