在Attendee子列表用户事件脚本上发送电子邮件复选框

时间:2017-06-20 20:46:12

标签: javascript netsuite suitescript

在NetSuite中,我有一个用于跟踪我们的安全会议的自定义记录,从记录中,我有一个用户事件脚本,BEFORE SUBMIT FUNCTION,运行以创建事件记录。在事件记录上 - >与会者子列表,我可以添加与会者,但我无法设置sendemail复选框。任何见解将不胜感激。

    /*

   user event script
   before record submit
   creates a new event record based off this safety meeting record. 

   */

   function createSafetyMeetingEventRec(type){


  if(type=="create")
  {
  try
  {

    //get values from the safety meeting record
    var altName = nlapiGetFieldValue('altname');
    var message = nlapiGetFieldValue('custrecord53');
    var local = nlapiGetFieldValue('custrecord56');
    var date = nlapiGetFieldValue('custrecord51');
    var time = nlapiGetFieldValue('custrecord52');


    //name of the event record
    var eventTitle = 'SM-' + altName;

    //create the event record
    var eventRec = nlapiCreateRecord('calendarevent');

        //set the event record field values
        eventRec.setFieldValue('title', eventTitle);


        //script search for the Safety Committee group members in netsuite
        var entitygroupSearch = nlapiSearchRecord("entitygroup",null,
                    [
                       ["internalid","anyof","120147"]
                    ], 
                    [
                       new nlobjSearchColumn("entityid","groupMember",null), 
                       new nlobjSearchColumn("internalid","groupMember",null)
                    ]
                    );

        //get who created the event, this user is automatically on the attendee list, and cannot be added again. 
        var eventUserSet = eventRec.getLineItemValue('attendee', 'attendee', 1);


            for(var i = 0; i < entitygroupSearch.length; i++){


                    var newAt = eventRec.getLineItemCount('attendee') + 1;

                    var intIDuser = entitygroupSearch[i].getValue("internalid","groupMember",null);



                    if(intIDuser != eventUserSet){

                        eventRec.setLineItemValue('attendee', 'sendemail', newAt, 'T');
                        eventRec.setLineItemValue('attendee', 'attendee', newAt, intIDuser);


                    }else{

                    continue;

                    }

            }


    //set the resource calendar to Service Calendar, 3 is the internal id of the service calendar resource

    var newAtResource = eventRec.getLineItemCount('resource') + 1;
    eventRec.setLineItemValue('resource', 'resource', newAtResource, '3');

var eventId = nlapiSubmitRecord(eventRec, true);



}catch(err)
{
    nlapiLogExecution("error","Error Creating Event Record From Safety Record ","Details: " + err.message);
}




 }//end if


 }

1 个答案:

答案 0 :(得分:0)

我认为你还需要

Process p = new Process();
p.WorkingDirectory = "path";
提交之前