Skip to main content
Question

Need help to return response from action button

  • August 3, 2024
  • 0 replies
  • 47 views

Hello, we have a requirement to import bulk Sales Order into Acumatica, so we created a custom screen and an action button in it. Then we created a web service endpoint with the custom screen and also added action in it. We are able to create Sales Order through postman but that doesn’t returning any response.

Please have a look at below code and guide in correct direction.

 

[PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Process", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
        public virtual IEnumerable process(PXAdapter adapter)
        {
            List<OrderImportFilter> list = adapter.Get<OrderImportFilter>().ToList();

            if (this.Filter.Current != null)
            {
                if (!string.IsNullOrEmpty(this.Filter.Current.OrderData))
                {
                    OrderResponse responseData = JsonConvert.DeserializeObject<OrderResponse>(this.Filter.Current.OrderData);

                    if (responseData != null)
                    {
                        List<ResponseJson> ResponseJsonList = OrderHelper.ProcessOrders(this.Filter.Current.OrderData);

                        string responsejson = JsonConvert.SerializeObject(ResponseJsonList);

                        OrderImportFilter objFilter = new OrderImportFilter();

                        objFilter.ResponseData = responsejson.ToString();

                        list.Add(objFilter);
                    }
                }
            }

            return list;
        }