Question

Save a record on button click

Hi,

 I have created a custom button on a new section edit page. On button click, the record have to save and then proceed with button action.

How can I do this?

Like 0

Like

4 comments

Hi Indira,

 

You need to add the save function to the "click" action handler for your button in schema diff. The example of a base "save" button action can be found in the SaveRecordButton item definition on the BaseDataView schema:

But on the example above the button tag is used to save the record in the onCardAction method triggering:

You can simply bind the save method of the BasePageV2 to the button "click" parameter or add the "tag" parameter with the "save" value.

 

Best regards,

Oscar

Hi Oscar,

 

Thanks for the response.

On the button click, the record should be saved and after saving the record we are having some other functionality. We have used calling this.save() method. We got an error saying that function is not found.

I have tried using tag: "save" , but didn't work.

Indira,

Hi,

 

I guess you are adding the button to the Section schema (like ContactSectionV2), not to the page schema (like ContactPageV2) and that's why you receive the "Uncaught TypeError: this.save is not a function" error message. This logic of calling the save function in the section is not needed since:

 

1) Which changes are you trying to save in the section directly?

2) Why won't you simply call the process execution without saving?

3) BaseSectionV2 has no implementation of the save function that's why the error is returned.

 

You will only be able to call the save function inside the page schema (like ContactPageV2) since the BasePageV2 has the save function logic implemented there and is needed since actual record changes are performed not in the section grid, but on the page directly.

 

Best regards,

Oscar

Hi Oscar,

 

I have added button to section page and trying to use save there itself.

I got error saying that function is not found in console while debugging the code.

Could you please tell me how to perform save in the section edit page.

Show all comments