How to get newly inserted id on OnResultExecuted

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi all,

I need help.

How to get inserted Id on "OnResultExecuted" event

My code is this.

public override void OnResultExecuted(ResultExecutedContext context)
{
  if (!(context.ActionDescriptor is ControllerActionDescriptor actionDescriptor)) return;

  if (actionDescriptor.ControllerTypeInfo == typeof([controllerName]) &&
    (actionDescriptor.ActionName == "Create" || actionDescriptor.ActionName == "Edit") &&
    context.HttpContext.Request.Method == "POST")
  {
    var data = context.HttpContext.Request.Form["Id"];
    var data1 = context.HttpContext.Request.Form["Text1"];
    var data2 = context.HttpContext.Request.Form["Text2"];
    return;
  }
  else
  {
    return;
  }
}

At the time of edit I get the id but at the time of create I can't get the Id field.
Is there any way to get the Id.
4 years ago
You would have to listen for an event on the particular entity you working with.

ID's and generally created server side and not parsed through ajax or form requests.
4 years ago
Hi All,

I want to save some extra fields on GenericAttribute at the time of Create or update.
Is there there any way to do this?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.