web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Type mismatch: The expected type is 'PurchId', but the actual type is 'int64'

(0) ShareShare
ReportReport
Posted on by 123
Hello everyone;
i am getting errors while taking an extension on standard code,
 
 
 
Error:
'PurchLine::find(InventTable::find(this.PurchaseOrderNumber).Product)' is not valid for field 'RemainPurchPhysical'.    

Error        Type mismatch in 'PurchLine.find' argument 1. The expected type is 'PurchId', but the actual type is 'int64'.
    
Error        Type mismatch in 'PurchLine.find' argument 1. The expected type is 'PurchId', but the actual type is 'int64'.    

Error        The qualifier 'PurchLine::find(InventTable::find(this.PurchaseOrderNumber).Product)' is not valid for field 'RemainPurchFinancial'.
I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    Type mismatch: The expected type is 'PurchId', but the actual type is 'int64'
    Hi, PurchPurchaseOrderLineV2Entity has PurchLine table as datasource. Then why not just create data entity extension and expose RemainPurchPhysical and RemainPurchFinancial fields instead of writing postLoad.
     
    If still you need postLoad method then try below code in postLoad method
     
    PurchLine purchLine = PurchLine::find(this.PurchaseOrderNumber, this.LineNumber);
    
    if (purchLine)
    {
        this.XTSDeliveryRemainder = purchLine.RemainPurchPhysical;
        this.XTSInvoiceRemainder = purchLine.RemainPurchFinancial;
    }
     
     
     
  • Suggested answer
    Martin Dráb Profile Picture
    236,192 Most Valuable Professional on at
    error:
    Your logic doesn't make any sense. For example, you take a purchase order number and try to find a release product with the same ID as the order ID. That's a nonsense.
     
    I wouldn't write any code at all - you can simply create an entity extension and add fields mapped to RemainPurchPhysical and RemainPurchFinancial of PurchLine data source.
     
    Also, please pay attention to which categories you select for your question. It clearly isn't about things like "Management Reporter" or "Go-Live".
  • Suggested answer
    Kevin Xia Profile Picture
    Microsoft Employee on at
    error:
    Hi,
    The second and third error messages show that the 'PurchLine.find' method expects a 'PurchId' as its first argument, but it's receiving an 'int64' instead. Double-check the data types in your code. Make sure that the data types of the variables or values you are passing to the 'PurchLine.find' method match what it expects. You might need to cast or convert the data types if necessary.
    The first and fourth error messages show that you are trying to use the 'PurchLine::find' method to search for a PurchLine record based on the result of InventTable::find(this.PurchaseOrderNumber).Product, but the 'RemainPurchPhysical' field is not compatible with this operation. To resolve this, you should review your code and make sure that the field you are trying to access ('RemainPurchPhysical') is appropriate for the result of your query. Ensure that the types match correctly.
    Best regards,
    Kevin
  • Layan Jwei Profile Picture
    8,034 Super User 2025 Season 2 on at
    error:
    Hi M R,

    If you look at the "find" method for PurchLine, it accepts PurchId as the first parameter which is a string
    and the InventTable "find" method, takes "ItemId" as an input

    Can you please explain what are you trying to do? isn't PurchRemainPhysical already in the entity?

    Thanks,
    Layan Jweihan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,351

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 874 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 638 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans