Name

global.PDDiagramProcessRepository

Description

No description available

Script

var PDDiagramProcessRepository = Class.create();
PDDiagramProcessRepository.prototype = {
  initialize: function() {
  },
  type: 'PDDiagramProcessRepository',
  updateProcess: function(fields) {
  	fields = fields || {};
  	var sysId = fields['sysId'];
  	if (!sysId)
          throw (gs.getMessage('Missing required field: sysId'));
  	var processGr = new GlideRecord(PDDiagramConstants.TABLES.PD_PROCESS_DEFINITION);
  	processGr.get(sysId);

  	if (!processGr)
  		throw (gs.getMessage('Unable to find process with id: {0}', sysId));

  	// Update the process GR
  	for (var fieldName in fields) {
  		var snakeCaseFieldName = PDDiagramUtils.camelcaseToSnakecase(fieldName);
  		if (snakeCaseFieldName === PDDiagramConstants.FIELDS.SYS_ID) //we never want to set the sys id of an update)
  			continue;
  		processGr.setValue(snakeCaseFieldName, fields[fieldName]);
  	}

  	if (!processGr.update())
          throw gs.getMessage('Unable to update [process] {0}: {1}', [sysId, activityGr.getLastErrorMessage()]);

  	// get fields from GR and return object
  	return {
  		sys_id: PDDiagramUtils.getFieldReturnValue(processGr, PDDiagramConstants.FIELDS.SYS_ID),
  		description: PDDiagramUtils.getFieldReturnValue(processGr, PDDiagramConstants.FIELDS.DESCRIPTION),
  		label: PDDiagramUtils.getFieldReturnValue(processGr, PDDiagramConstants.FIELDS.LABEL),
  		view_type: PDDiagramUtils.getFieldReturnValue(processGr, PDDiagramConstants.FIELDS.VIEW_TYPE),
  		designer_state: PDDiagramUtils.getFieldReturnValue(processGr, PDDiagramConstants.FIELDS.DESIGNER_STATE),
  	};

  }
};

Sys ID

bd43836a772b11108188ceec8e5a9914

Offical Documentation

Official Docs: