Name

sn_esign.esign_task

Description

No description available

Script

var esign_task = Class.create();
esign_task.prototype = {
  initialize: function(_gr, _gs) {
  	this._gr = _gr;
  	this._gs = _gs || gs;
  },
  
  canESign : function() {
  	//Task must be active
  	if (!this._gr.active)
  		return false;
  	
  	// State must be Ready or Work In Progress
  	if (this._gr.state != 10 && this._gr.state != 18 && this._gr.state != 2 && !(this._gr.getTableName() == 'sn_cd_task' && this._gr.state == 1))
  		return false;
  	
  	// Check for e-signature configuration
  	if (!this._gr.sn_esign_esignature_configuration)
  		return false;
  	
  	// Task must be assigned or delegated to user
  	if (this._gr.assigned_to != this._gs.getUserID() && (!GlidePluginManager().isActive('com.glide.granular_service_delegation') || !new sn_delegation.DelegationUtil().isRecordDelegatedToUser(this._gs.getUserID(), this._gr)))
  		return false;
  	
  	return true;
  },
  
  canAcknowledge : function() {
  	//Signature type should be acknowledgement
  	if(this.canESign() && this._gr.sn_esign_esignature_configuration.signature_type == "acknowledgement") 
  		return true;
  	
  	return false;
  },
  
  canAuthenticate : function() {
  	//Signature type should be credential
  	if(this.canESign() && this._gr.sn_esign_esignature_configuration.signature_type == "credential") 
  		return true;

  	return false;
  },
  
  canSign : function() {
  	//Signature type should be signature
  	if(this.canESign() && this._gr.sn_esign_esignature_configuration.document_type != "document_template" && this._gr.sn_esign_esignature_configuration.signature_type == "signature") 
  		return true;

  	return false;
  },
  
  canSignDocumentTemplate : function() {
  	if(this.canESign() && this._gr.sn_esign_esignature_configuration.document_type == "document_template" && this._gr.sn_esign_esignature_configuration.signature_type == "signature") 
  		return true;
  	return false;
  },
  
  canSignDocument : function() {
  	return this.canESign() && (this.canAcknowledge() || this.canAuthenticate() || this.canSign());
  },
  
  type: 'esign_task'
};

Sys ID

82a7830477232300f1b4e431a91061ca

Offical Documentation

Official Docs: