Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
3 replies
Subscribers
7 subscribers
Views
6026 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Update data to DB
andrin
over 7 years ago
Hi,
I'm having problem with scripting for updating value to DB,
I have and object with below structure
Client(
IdAccess,
PhoneNo,
Email,
Password
)
How to manipulate and object from query below for instance to update an email address to another value from "http!request.queryParameters.email"? I need this for saving it to DB! or any simple way to do only for updating field?
local!clientAccess: a!queryEntity(
entity: cons!ITR_CONS_Client,
query:
a!query(
logicalExpression:a!queryLogicalExpression(
operator:"AND",
filters:{
a!queryFilter(
field: "PhoneNo",
operator: "=",
value:http!request.queryParameters.userId
),
a!queryFilter(
field: "Password",
operator: "=",
value:http!request.queryParameters.oldPassword
)
}
),
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 50
)
)
).data
OriginalPostID-269252
Discussion posts and replies are publicly visible
Parents
0
andrin
over 7 years ago
Hi,
Thanks for replying, I'm able update using below script:
a!writeToDataStoreEntity(
dataStoreEntity: cons!ITR_CONS_ClientAccess,
valueToStore: {
IdAccess:local!clientAccess.IdAccess,
PhoneNo:local!clientAccess.PhoneNo,
Email:http!request.queryParameters.Email,
Password:local!clientAccess.newPassword
}
,
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "success",
message: ""
}
)
),
onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "error",
message: "There was an error writing to the data store"
}
)
)
)
Is there any simple way to update only certain column (Email column), no need to define all the column?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
andrin
over 7 years ago
Hi,
Thanks for replying, I'm able update using below script:
a!writeToDataStoreEntity(
dataStoreEntity: cons!ITR_CONS_ClientAccess,
valueToStore: {
IdAccess:local!clientAccess.IdAccess,
PhoneNo:local!clientAccess.PhoneNo,
Email:http!request.queryParameters.Email,
Password:local!clientAccess.newPassword
}
,
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "success",
message: ""
}
)
),
onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "error",
message: "There was an error writing to the data store"
}
)
)
)
Is there any simple way to update only certain column (Email column), no need to define all the column?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data