Merged PR 2263: createinvolvement updates contactinvolvement table

createinvolvement updates contactinvolvement table

Related work items: #22441
This commit is contained in:
Robert Bond
2026-04-21 16:16:31 +00:00
parent 5bf885933d
commit f34ac3ba11
3 changed files with 29 additions and 9 deletions
+21 -6
View File
@@ -15,6 +15,7 @@ import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { hashAPIPath } from "../../../actions/core/hash";
import { respondError, respondSuccess } from "../middleware/apiResponse";
import { getPersonalAccount } from "../../../actions";
const WEBAPI_URL =
process.env.RELAY_ROOT ||
@@ -37,17 +38,31 @@ export default async function ApiProxy(req, res) {
const token = await getToken();
const contactid = req.body.contactid;
const queryUrl =
"incidents(" +
req.body.incidentid +
")/pinswg_incident_contact_case_involvement/$ref";
const incidentid = req.body.incidentid;
const queryUrl = "pinswg_contactinvolvements";
const userInfo = await getPersonalAccount(contactid);
const crmUrl = "https://" + process.env.CRMURL;
const crmVersion = process.env.CRMURL_VERSION;
// appeallant
// interestedParty
// agent
var typeofinvolvement =
{
"appellant": 846040001,
"interestedparty": 846040061,
"agent": 846040000
}[req.body.typeofinvolvement] || 846040061;
const data = {
"@odata.id":
crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")"
"pinswg_email": userInfo.emailaddress1,
"pinswg_lastname": userInfo.lastname,
"pinswg_firstname": userInfo.firstname,
"pinswg_typeofinvolvement": typeofinvolvement,
"pinswg_Case@odata.bind": "/incidents(" + incidentid + ")",
"pinswg_Contact@odata.bind": "/contacts(" + contactid + ")"
};
const config = {