Solved

WebService Enpoint

  • 2 September 2022
  • 3 replies
  • 261 views

Userlevel 2

Hello all 

I have made a custom Inquiry screen, that filters and provides a record based on passing 3 input parameter.

Item Sales Price Screen

Now I want the same value to be returned when via WebService . I did extend  my webservice Endpoint and added new screen. However, I am not able to see the right value on mapped object 

Item Sales Price Inquiry



When I call via my POSTMAN, I get empty result. 

Below is my code.

public class ItemSalesPrice : PXGraph<ItemSalesPrice>
    {


        public PXFilter<SalesPriceFilter> Filter;

        [PXFilterable]
        public PXSelect<SalesPriceResult> DetailsView;

        public PXCancel<SalesPriceFilter> Cancel;

        protected virtual IEnumerable<SalesPriceResult> detailsView()
        {
                 ----
                yield return ar;
            }
        }
}

 

    public class SalesPriceFilter : IBqlTable
{
#region CustomerID
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[CustomerActive(DisplayName = "Customer ID", Required = true,IsKey =true)]
public virtual int? CustomerID { get; set; }
public abstract class customerID :
PX.Data.BQL.BqlInt.Field<customerID>
{ }
#endregion

#region InventoryID
[PXInt(IsKey = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Inventory ID", Required = true)]
[PXSelector(typeof(Search<InventoryItem.inventoryID>),
typeof(InventoryItem.inventoryCD),
typeof(InventoryItem.descr),
SubstituteKey = typeof(InventoryItem.inventoryCD))]
public virtual int? InventoryID { get; set; }
public abstract class inventoryID : PX.Data.BQL.BqlInt.Field<inventoryID> { }
#endregion


#region Uom
[PXString(IsKey = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "UOM", Required = true)]
[PXSelector(typeof(Search<INUnit.fromUnit>),
typeof(INUnit.fromUnit),
SubstituteKey = typeof(INUnit.fromUnit))]
public virtual string Uom { get; set; }
public abstract class uom : PX.Data.BQL.BqlString.Field<uom> { }
#endregion

}

 

    public class SalesPriceResult : IBqlTable
{
#region UsrInventoryID
[PXString]
[PXUIField(DisplayName = "Inventory ID", IsReadOnly = true)]
public virtual string UsrInventoryID { get; set; }
public abstract class usrInventoryID : PX.Data.BQL.BqlString.Field<usrInventoryID> { }
#endregion

#region UsrCustomerID
[PXString]
[PXUIField(DisplayName = "Customer ID", IsReadOnly = true)]
public virtual string UsrCustomerID { get; set; }
public abstract class usrCustomerID : PX.Data.BQL.BqlString.Field<usrCustomerID> { }
#endregion

#region UsrSalesPrice
[PXDecimal(6)]
[PXUIField(DisplayName = "Sales Price", IsReadOnly = true)]
public virtual Decimal? UsrSalesPrice { get; set; }
public abstract class usrSalesPrice : PX.Data.BQL.BqlDecimal.Field<usrSalesPrice> { }
#endregion

#region UsrSalesPrice
[PXString()]
[PXUIField(DisplayName = "Unit of Measure", IsReadOnly = true)]
public virtual string UsrUom { get; set; }
public abstract class usruom : PX.Data.BQL.BqlString.Field<usruom> { }
#endregion
}

Could anyone suggest on how can I add my input parameter on mapped Object.

Appreciate help. Thank you.

 


 

icon

Best answer by DavidEichner 2 September 2022, 19:23

View original

3 replies

Userlevel 2

I got the Api Wokring. I had to specify (Is key= True) on my Dac for all the parameter inside my filter. 
 

Userlevel 2

Hi @DavidEichner 

Thanks for the reply .Yes I did follow the Steps described on the article. 

I do get the results as of when I try via postman. But I am missing the Sales Price Value and get an empty Result.
 



When I hit the API and debug in my visual Studio, I do see the Sales Price is Set .
 


So my code does return the values.

I am even specifying the Endpoint values, with mapped Object.
 


 



Not Sure why my Endpoint is not returing me the Sales Price Value. 

Thanks 

 

Userlevel 7
Badge +10

Have you tried following the steps in this article?

https://www.acumatica.com/blog/contract-based-apis-in-generic-inquiries/

 

Best,

 

David Eichner, CPA

 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved