Are there any other troubleshooting steps I can ta...
# general
a
Are there any other troubleshooting steps I can take to find out why this user event script didn't execute on 3/22/24 when this Sales Order was created at 6:37pm? All the configurations indicate that it definitely should have run, but there are no script logs under Michal for that day. Environment: Sandbox Script: Auto-Process Orders - User Event Sales Order System Note attached shows that it was created in the UI Server script log report (attached) criteria: • Date is 3/22/24 • Script is Auto-Process Orders - User Event The last two logs--nothing ran at ~6:37pm, and nothing is under Michal. The sales order internal ID in the script log title also doesn't match the SO for any of the logs Entry function code snippet: (so you can see the script should have logged something)
Copy code
function afterSubmit(ctx) {
  const log_ = {
    start: Date.now(), ueType: ctx.type, exeCtx: runtime.executionContext,
  };
  let id = ctx.newRecord.id;

  if (createApproveOrEditInUIOrWebService(ctx)) {
    try {
      ctrl.autoProcessOrder(id, log_);
    }
    catch (err) {
      log_.error = err;
    }
  }

  log_.end = Date.now();
  log_.time = log_.end - log_.start;
  if (log_.error) {
    log.error({ title: `Error Auto-Process ${id}`, details: log_ });
  }
  else {
    log.audit({ title: `Auto-Process ${id}`, details: log_ });
  }
}

function createApproveOrEditInUIOrWebService({ type, UserEventType }) {
  const { executionContext, ContextType } = runtime;
  let creating = type === UserEventType.CREATE,
      copying = type === UserEventType.COPY,
      approving = type === UserEventType.APPROVE,
      editing = type === UserEventType.EDIT,
      inUI = executionContext === ContextType.USER_INTERFACE,
      webServiceCall = executionContext === ContextType.WEBSERVICES;
  let validUEType = (creating || copying || approving || editing),
      validExeCtx = (inUI || webServiceCall);

  return validUEType && validExeCtx;
}
s
Try it without ticking All Employees. I only ever tick All Roles, nothing else.
If the user event is triggered by a map/reduce or other server side script, the Employee is "system" and may not trigger when an employee filter is set, even "all"
👍 1