crt.SaveDataRequest calls update query instead of Insert query

Hello Everyone,

I have this button, which is suppose to save data on clicking, on clicking the button is executing Query but it is always using Update Query, I want to execute insert query in case it is new entry.

Can any one guide me on how to do this?

{
                "operation": "insert",
                "name": "SaveButton",
                "values": {
                    "layoutConfig": { "column": 1, "row": 4 },
                    "type": "crt.Button",
                    "caption": "Save",
                    "color": "primary",
                    "clicked": {
                        "request": "crt.SaveDataRequest",
                        "params": {
                            "dataSourceName": "UsrConfigDS",
                            "parameters": [
                                { type: "primaryColumnValue", value: Terrasoft.generateGUID() } 
                            ],
                            "config": {
                                "silent": "true", 
                                "payload": {
                                    "UsrRegion": "$Region",  
                                    "UsrKey": "$Key" 
                                }
                            }
                        },
                    },
                },
                "parentName": "GridContainer_da9zpnz",
                "propertyName": "items",
                "index": 3
            }

Like 0

Like

2 comments
Best reply

Hello Madhav,

 

Page designer allows you to add Save button to your page easier by adding a button and setting its Action to Save data value.

 

Page Designer

 

The system will identify automatically if it's a new record or existing one and will call InsertQuery or UpdateQuery accordingly.

 

In the source code the button will look as following

 

{
	"operation": "insert",
	"name": "Button_xx1i3cp",
	"values": {
		"type": "crt.Button",
		"caption": "#ResourceString(Button_xx1i3cp_caption)#",
		"color": "primary",
		"disabled": false,
		"size": "large",
		"iconPosition": "only-text",
		"visible": true,
		"clicked": {
			"request": "crt.SaveRecordRequest"
		},
		"clickMode": "default"
	},
	"parentName": "MainHeaderTop",
	"propertyName": "items",
	"index": 1
}

Hello Madhav,

 

Page designer allows you to add Save button to your page easier by adding a button and setting its Action to Save data value.

 

Page Designer

 

The system will identify automatically if it's a new record or existing one and will call InsertQuery or UpdateQuery accordingly.

 

In the source code the button will look as following

 

{
	"operation": "insert",
	"name": "Button_xx1i3cp",
	"values": {
		"type": "crt.Button",
		"caption": "#ResourceString(Button_xx1i3cp_caption)#",
		"color": "primary",
		"disabled": false,
		"size": "large",
		"iconPosition": "only-text",
		"visible": true,
		"clicked": {
			"request": "crt.SaveRecordRequest"
		},
		"clickMode": "default"
	},
	"parentName": "MainHeaderTop",
	"propertyName": "items",
	"index": 1
}

@Iryna Oriyenko, got it. Thank you !!

Show all comments