on 10-25-2022 8:36 AM
Hi,
I am using a following action to UpdateEntity action the one property of my entity Set and then overriding the entity set from a rules. But when the action executed for the first time it's worked perfectly but when I performing same action on the same entity the action returning success but the entity set is not getting updated.
{ "_Type": "Action.Type.ODataService.UpdateEntity", "Target": { "Service": "/SampleMDKApp/Services/com_test_mdk_app_service.service", "EntitySet": "TestGRDetails", "ReadLink": "{@odata.readLink}" }, "Properties": { "Status": "0" }}
UpdateStatus.js
export default function UpdateStatus(clientAPI) {
let selectedItem = clientAPI.getPageProxy().getActionBinding();
let name = selectedItem["Name"] let status = selectedItem["Status"]
let updatedStatus = (status === "1") ? "0" : "1"
let updatePromise = clientAPI.executeAction({ "Name": "/SampleMDKApp/Actions/Application/UpdateGRStatusAction.action", "Properties":{ "Status": updatedStatus
} });
updatePromise.then((result)=>{ alert(`${name} Status Updated.`); }).catch((err) => { alert(`UpdateStatus Clicked `); });
return updatePromise;}
You may want to also override the ReadLink to ensure that the update action is always targeting the correct entity.
let updatePromise = clientAPI.executeAction({
"Name": "/SampleMDKApp/Actions/Application/UpdateGRStatusAction.action",
"Properties": {
"Target": {
"ReadLink": selectedItem['@odata.readLink']
},
"Properties": {
"Status": updatedStatus
}
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer it's worked.
User | Count |
---|---|
74 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.