Name

global.AgileAjaxProcessor

Description

No description available

Script

var AgileAjaxProcessor = Class.create();
AgileAjaxProcessor.prototype = Object.extendsObject(AbstractAjaxProcessor, {
  updateStoryDefect: function() {
  	var result = this.newItem("result");
  	var storySysId = this.getParameter('sysparm_story_sys_id');
  	var defectSysId = this.getParameter('sysparm_defect_sys_id');
  	var gr;
  	
  	try {
  		if (!storySysId)
  			throw new Error('sysparm_story_sys_id is missing');
  		
  		if (!defectSysId)
  			throw new Error('sysparm_defect_sys_id is missing');
  		
  		gr = new GlideRecordSecure('rm_story');
  		
  		if (gr.get(storySysId)) {
  			gr.defect = defectSysId;
  			if (gr.update()) {
  				result.setAttribute('status', 'success');
  				result.setAttribute('message', 'story.defect has been updated successfully');
  			} else {
  				throw new Error('unable to update story ' + storySysId);
  			}
  		} else
  			throw new Error('story record ' + storySysId + ' does not exist');
  	} catch (err) {
  		result.setAttribute('status', 'failed');
  		result.setAttribute('message', err.message);
  	}
  },
  
  type: 'AgileAjaxProcessor'
});

Sys ID

9ec5a04f738213003ade8889faf6a73f

Offical Documentation

Official Docs: