rt - I want to check the previous status within an RT scrip?
问题描述
my $TransactionPreviousStatus = $self->TicketObj->Status->OldValue
:
I am thinking this should give the old status but I end up getting the current status
For Ex:
Old status: open
Current Status: reply-pls
So when somebody will reply on the ticket, a custom script will execute which should change the status to old value (i.e., open) but again it goes back to reply-pls.
解决方案
您不能在 TicketObj 上调用 OldValue,它是一个 Transaction 方法。因此,如果我正确理解了您的需求,您需要编写一个脚本,触发 StatusChange && Correspondence 设置状态。这有点棘手。
AFAIK,您需要创建一个在 Correspondence 上触发的批处理脚本,然后找到 StatusChange 的最后一个事务并将其还原。像这样的东西可以工作:
Description: On correspond don't change the status
Condition: On Correspond
Action: User defined
Template: Blank
Stage: Batch
Custom action commit code:
my $transactions = $self->TicketObj->Transactions;
my $last_status;
while (my $transaction = $transactions->Next) {
if ($transaction->Type eq "Status" ) {
$last_status = $transaction;
}
}
$self->TicketObj->SetStatus($last_status->OldValue);
推荐阅读
- css - Protractor E2E:失败,使用定位器找不到元素:By(css选择器)
- scala - 将带有 json 字符串的数据框列转换为不同的列
- python - python dataframe中将excel文件读取为csv文件时的日期格式问题
- django - 在 Kubernetes 上安装 CVAT
- java - 是否可以在 kotlin 中创建一个 ByteArray 的 ByteArray 作为元素?
- java - 尝试使用它们时,同一调用中的两个泛型方法是否会导致编译错误?
- python - 为什么默认情况下不启用“PEP 572 -- 赋值表达式”?
- java - Tomcat 中的 HyperSQL 数据库在 Linux 重启后被删除
- html - 如何使用 R 解析 html 文本?
- image - VBScript 以文件名作为标题将图像导入单词