Custom Angular API for triggering a process

I'd like to trigger a process through a press of a button on 9.2.x Angular portal. I've checked API documentation but can't seem to find the correct API for my need.
Do any APIs like this already exist that I might have overlooked? If no, would you recommend that I write a custom API or do you have any other viable solutions?

Parents Reply Children
  • I was also looking for a way to trigger a process.

    First found this 
    To generate an event for an entity, use the URL <baseURL>/api/entity/{table}/{uid}/event/{eventName}.
    NOTE: The authenticated user must be entitled to use the program function Allow to trigger any events from the frontend in order to call an event on an entity.

    My second option .GenerateAsync (not publicly documented afaik?) testcode so far I haven't tried it yet
    Wanted to see if this option works without having the authenticated user be assigned to the program feature with the event: QBMEventHasFeature

      PortalApiProject>, IApiProvider
      {
        public void Build(IApiBuilder builder)
        {
          builder.AddMethod((IMethod) Method.Define("processautomation/checksomething").WithDescription<IMethod>("Starts the process checksomething").Handle("POST", (Func<IRequest, CancellationToken, Task>) (async (request, ct) =>
          {
            IEntity entity = await request.Session.Source().GetAsync(Query.From((IDbObjectKey) new DbObjectKey("DialogDatabase", "2C8487D522234560BF2F89BB6FBF20DC")).SelectAll(), EntityLoadType.Interactive, ct).ConfigureAwait(false);
            using (IUnitOfWork u = request.Session.StartUnitOfWork())
            {
              await u.GenerateAsync(entity, "CHECKSOMETHING", cancellationToken: ct).ConfigureAwait(false);
              await u.CommitAsync(ct).ConfigureAwait(false);
            }
          })));
        }
      }
    }