Name

sn_ppt_export.PPTCommonUtil

Description

Content-Generation This file provides common methods used in both parsing and generation operation of ppt. Warning Customers should not modify this file.

Script

var PPTCommonUtil = Class.create();
PPTCommonUtil.prototype = {
  initialize: function() {},

  initializeLogRecord: function(templateID) {
  	var generatePPTUtil = new GeneratePPTUtil(templateID);
  	var reportTypeID = '';
  	try {
  		reportTypeID = generatePPTUtil.getReportTypeSysID();
  	} catch (e) {
  		gs.info(e.message);
  	}
  	var statusGr = new GlideRecordSecure(GeneratePPTConstants.PPT_OPERATION_STATUS_TABLENAME);
  	statusGr.initialize();
  	statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_PROCESSED_ID_FIELDNAME, templateID);
  	statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_REPORT_TYPE_FIELDNAME, reportTypeID);
  	return statusGr.insert();
  },

  updateLogRecord: function(statusRecordID, operationType, response) {
  	var statusGr = new GlideRecordSecure(GeneratePPTConstants.PPT_OPERATION_STATUS_TABLENAME);
  	statusGr.get(statusRecordID);
  	if (statusGr.isValidRecord()) {
  		statusGr.setValue(GeneratePPTConstants.OPERATION_TYPE_FIELDNAME, operationType);
  		if (!response["is_error"]) {
  			statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_FIELDNAME, "success");
  			statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_ATTACHMENT_FIELDNAME, response["response_body"]);
  			statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_MESSAGE_FIELDNAME,"Operation successful");
  		} else {
  			statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_FIELDNAME, "failed");
  			statusGr.setValue(GeneratePPTConstants.OPERATION_STATUS_MESSAGE_FIELDNAME, response["response_body"]);
  		}
  		statusGr.update();
  	}
  },

  type: 'PPTCommonUtil'
};

Sys ID

e1a3d95953420110b595ddeeff7b120a

Offical Documentation

Official Docs: