In Global workflow:
function getDate(){ return new Date(); }
In Sheet’s Approval workflow:
var Action = { Create: 'CREATE', Reject: 'REJECT', Finish: 'FINISH', Cancel: 'CANCEL', } try { // Get NodeID var nodeId = approvalParam.getEntryRootNodeId(); // Get Approval Status var action = approvalParam.getApprovalAction(); var now = getDate(); // wrong here switch (action) { case Action.Finish: log(nodeId, "do Finish"); log(nodeId, now); break; case Action.Cancel: log(nodeId, "do Cancel"); log(nodeId, now); break; } } catch (error) { log(nodeId, "error:" + error.message) } /** write debug message in record */ function log(nodeId, text) { var query = db.getAPIQuery("/ragicinventory/17"); var record = query.getAPIEntry(nodeId); record.setFieldValue(999, record.getFieldValue(999) + "\r\n" + text); record.save(); }
Then try to sign this sheet,in my debug message always show “getDate” is not defined
Is it because I set it wrong or is it a bug?
Thanks in advance,
Bonder