Refresh data grid when clicking button

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