美文网首页NETSUITE开发者实战培训
【CASE/邮件/脚本】如何在客人回复邮件的时候修改CASE的内

【CASE/邮件/脚本】如何在客人回复邮件的时候修改CASE的内

作者: e85a69573d55 | 来源:发表于2019-09-24 20:24 被阅读0次

场景

当客户回复案例电子邮件(CASE)时,NetSuite会创建一个新的Message记录,并引用该案例,但不会对该案例记录进行任何更改,因此,不会触发部署到该案例记录的用户事件脚本和工作流。

方案

以下步骤显示了如何创建用户事件脚本并将其部署到Messages中,以在客户通过电子邮件更新案例时将案例的状态更改为“重新打开”:

function afterSubmit(type)

{

// Load the message record

var message = nlapiGetNewRecord();

// Get the ID of the activity associated with the message

var activity = message.getFieldValue('activity');

// If there is any activityif(activity)

{

// If the activity is a case, load the record and change the status.try

{

var caseRecord = nlapiLoadRecord('supportcase', activity);

caseRecord.setFieldValue('status',4);

nlapiSubmitRecord(caseRecord);

}

// If the activity is not a Case, log a warning messagecatch(exec)

{

nlapiLogExecution('DEBUG', 'Warning','Activity Record is not a Case');

}

}

}

-部署脚本

1. Go to Customization > Scripting > Scripts > New.

2. Select User Event.

3. In the Name field, enter UE Message.

4. Under the Scripts tab:

In the Script File field, select the JavaScript file created before.

In the After Submit Function field, enter afterSubmit

5. Under the Deployments tab, create a new deployment:

Applied To = Message

Deployed = Yes

Status = Released

Log Level = Debug

相关文章

网友评论

    本文标题:【CASE/邮件/脚本】如何在客人回复邮件的时候修改CASE的内

    本文链接:https://www.haomeiwen.com/subject/kspbuctx.html