Home / Questions / Table method exists() in D365
Explanatory Question

Table method exists() in D365

👁 2,865 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

As with the find method, there should also exist an exists method. It basically works the same as the find method, except that it just returns true if a record with the unique index specified by the input parameter(s) is found. In the next example from the InventTable you can see that it returns true if the input parameter has a value AND the select statement returns a value.



static boolean exist(ItemId itemId)
{
    return itemId && (select RecId from inventTable
    index hint ItemIdx
    where inventTable.ItemId == itemId
    ).RecId != 0;
}