NodeJS 如何通过API在BMC Remedy中更新事件状态?

mnemlml8  于 2023-06-29  发布在  Node.js
关注(0)|答案(1)|浏览(142)

在我的项目中,我们集成了BMC Remedy API来创建带有评论和附件的事件,过滤事件,获取事件。所有这些工作正常。
现在的要求是通过API将已创建事件的状态更新为已关闭。我使用nodejsexpress
下面是要测试的代码片段:

get('INC000000021072', true) // works fine
.then(inc => update(inc, { Status: 'Closed'})) // getting an error - Field ID specified is not found on this form.
.then(() => get('INC000000021072', true))
.then((inc) => console.log(inc));

更新功能:

async function update(incident, values) {
  console.log('update method #############',{ incident, values});
  try{
    const result = await query({
      uri: `HPD:IncidentInterface/${incident.id}`,
      method: 'PUT',
      json: { values },
    });
    console.log(result); // never gets here due to error
  } catch(error) { console.log(error) };
}

更新我可以用请求ID更新submitter和description等字段。但无法更新状态。在更新所有分配相关字段的状态时,我收到以下错误:

[
    {
        "messageType": "ERROR",
        "messageText": null,
        "messageAppendedText": "The Assigned Group fields are invalid.  Use the menus for the Support Company, Support Organization, Assigned Group, and Assignee fields or the type ahead return function on the Assigned Group or Assignee fields to select this information.",
        "messageNumber": 1291053
    }
]

是否有用于更新事件状态的特定界面?是否需要发送任何其他字段以更新事件状态?

jum4pzuy

jum4pzuy1#

下面的解决方案适用于我:传递要更新的事件和值。此外,事件请求ID必须传递以更新事件。

async function update(incident, values) {
  try{
    await query({
      uri: `HPD:IncidentInterface/${incident.requestId}`,
      method: 'PUT',
      json: { values },
    });
  } catch(error) { console.log(error) };
}

要更新状态,需要通过以下字段:

Status: "Closed",
      'Assigned Group': "xxxxx",
      Assignee: "xxxxx",
      'Assignee Login ID': "xxxxx",
      'Assigned Support Company': "xxxxx",
      'Assigned Support Organization': "xxxxx",

相关问题