How to use Guide Datatype in BC

How to use GULD in BC, And how to visible only limited identifiers through GUID

In Business Central, a GUID (Globally Unique Identifier) data type can be used to store unique identification values. A GUID is a 128-bit value guaranteed to be unique across all devices and at all times.

To use a GUID data type in Business Central, you can create a field in a table with the data type “TEXT” using the development environment. For example, you can add a field named “MyGUID” with data type TEXT to a table.

To Create a GUID we are creating a field in the table with data type as text and assigning that field to a function as “CREATEGUID” to get the GUID value.

Example for GUID

Table for GUID:

Card Page for GUID      

For getting a unique Guid number we are writing the code on Trigger OnNewRecord

The output of GUID:

In this way, we will be using a guide

Scenario 2:

Also, if want to Generate random numbers through GUID and want to limit the numbers or want to show a few characters from the guide

Example:

Requirement: Through GUID generate random numbers but only show the 10 Characters from GUID.

In this scenario, we will limit the guide by Writing the code on OnNewRecord Trigger

We will be following the same table as shown above for GUID.

In GUID Card we will write code as follow,

OUTPUT:

In Summary, we can use GUID when wanting Unique Identifiers, Also with GUID we can specify how many characters we want to show,

It’s important to note that the GUID data type should be used only when a unique identifier is required, as it can take more space than other data types and also it is not indexed, so it can affect the performance when searching for a record with a specific GUID.

Pooja Zinjurke

Technical Consultant – D365 BC

Addend Analytics

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.