Editable Grid Issue : Not able to remove and update data in database

When I try to remove grid row that time shows this error :  "An error occurred while executing a save: Expression evaluation error at function 'remove' [line 103]: Invalid index (3) for list: valid range is 1...1"

When I try to Update grid row that time shows this error :  "An error occurred while executing a save: Expression evaluation error: The save target must be a local variable that does not refresh on every evaluation or on an interval, a process variable, or a node input (or a rule input passed one of those three), but instead was: [startIndex=1, batchSize=-1, sort=[field=Name, ascending=true], totalCount=7, data=[......], identifiers=10; 9; 11; 1; 12; 8; 39]" 

Code: 

load(
ri!Customer: rule!CustomerInfo_ExpRule(),
with(
a!formLayout(
label: "Add,Update, or Remove Customer Data",
contents: {
a!gridLayout(
totalCount: count(ri!Customer),
headerCells: {
a!gridLayoutHeaderCell(label: "Name" ),
a!gridLayoutHeaderCell(label: "Address" ),
a!gridLayoutHeaderCell(label: "OrgName" ),
a!gridLayoutHeaderCell(label: "Salary" ),
a!gridLayoutHeaderCell(label: "ContactNo" ),
a!gridLayoutHeaderCell(label: "Emaild"),
a!gridLayoutHeaderCell(label: "Location"),
a!gridLayoutHeaderCell(label: "" )
},

columnConfigs: {
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:2 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:4 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "ICON")
},
rows: a!forEach(
items: rule!CustomerInfo_ExpRule(),
expression: a!gridRowLayout(
id: fv!index,
contents: {

a!textField(

label: "Name" & fv!index,
value: fv!item.Name,
saveInto: fv!item.Name,
required: true
),

a!textField(
label: "Address" & fv!index,
value: fv!item.Address,
saveInto: fv!item.Address,
required:true
),

a!textField(
label: "OrgName" & fv!index,
value: fv!item.OrgName,
saveInto: fv!item.OrgName,
required:true
),
a!floatingPointField(
label: "Salary" & fv!index,
value: fv!item.Salary,
saveInto: fv!item.Salary,
required:true
),
a!integerField(
label: "ContactNo" & fv!index,
value: fv!item.ContactNo,
saveInto: fv!item.ContactNo
),
a!textField(
label: "EmailID" & fv!index,
value: fv!item.Emaild,
saveInto: fv!item.Emaild,
required:true
),

a!textField(
label: "Location" & fv!index,
value: fv!item.Location,
saveInto: fv!item.Location,
required:true
),
a!imageField(
label: "delete " & fv!index,
images: a!documentImage(
document: a!iconIndicator("REMOVE"),
altText: "Remove Customer",
caption: "Remove " & fv!item.Name,
link: a!dynamicLink(
value: fv!index,
saveInto: {
a!save(ri!Customer, remove(ri!Customer, save!value)),
a!save(ri!DeletedCustomer, append(ri!DeletedCustomer, fv!item)),
a!deleteFromDataStoreEntities(
a!entityDataIdentifiers(
entity: cons!DSE_CustomerInfo,
identifiers: ri!DeletedCustomer
)
)
}
)
),
size: "ICON"
)
}
)
)
,
addRowlink: a!dynamicLink(
label: "Add Employee",

value: 'type!{urn:com:appian:types}CustomerInfo'(),
saveInto: {
a!save(ri!Customer, append(ri!Customer,save!value))
}
)
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(
label: "Submit",
saveInto:{ a!writeToDataStoreEntity(
dataStoreEntity: cons!DSE_CustomerInfo,
valueToStore: ri!Customer
)
}
)
)
)
)
)

Thanks,

Kunal

  Discussion posts and replies are publicly visible