update proxy for get - update appeal record data
This commit is contained in:
@@ -18,9 +18,19 @@ let CompleteAppeal = (props) => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = props.props.form.appealForm.values;
|
||||
|
||||
let updateBindAppealTypeToIncident =
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
].replace(/[\s\-\+\(\)\,\&\.]/g, "") +
|
||||
"Ids";
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||
"/incidents(" + incidentId + ")",
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
@@ -35,7 +45,22 @@ let CompleteAppeal = (props) => {
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
updateCase(incidentId, updateBody, updateFormCollection);
|
||||
let primaryAttribute = getPrimaryAttr(
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
updateCase(
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
}, [props.appealType.caseReference, props.props.form.appealForm.values]);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
@@ -47,6 +72,14 @@ let CompleteAppeal = (props) => {
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getPrimaryAttr = (formtype) => {
|
||||
const attrName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].PrimaryIdAttribute"
|
||||
);
|
||||
return attrName[0];
|
||||
};
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
Reference in New Issue
Block a user