How to perform CRUD operations using classes and representations in Sage X3 V12.

By | April 1, 2023

Introduction:

Sage X3 provides various features with user friendly screens and their amazing functionalities. The screens can be of various types such object based, function action based, inquiry screens , etc. For performing create, read, update and delete operations on a table, we need to have a screen for entering those data but what if there is a requirement where the user does not have any screen and have to perform CRUD operations on a particular table.This can be achieved by one of the features provided by Sage X3 using classes and representations concepts.

In this blog we will perform the basic read and write operations using classes and representation instead of creating objects and screens. Consider an example where the user wants to perform CRUD operations on a table.

Navigate to All -> Development -> Data and parameters -> Tables

Create a new table with some sample fields as shown in below figure.

Navigate to All -> Development -> Data and parameters -> Classes

Create a new class, enter the class code , select type as “Persistent”, table-view as table created earlier as well as the index code, as shown in below figure.

Go to the “Properties” tab and click on the action button (3 dots) and select the “Column selection” option as shown in the figure below.

As shown in below figure, after selecting the “Column selection” option, the screen below will appear. Check the fields and select “Yes” in the “Y/N” column and click on the “OK” button  so that these fields will be included from the table created earlier into the class.

Now, create the class , go to the “Standard methods” tab and select the methods the user needs to perform such as creation, read, deletion, etc. as shown in the below figure.

Click on “Save” ,“Validation” and “Global Validation” buttons.

Next, we need to create a representation for this class.

Navigate to All -> Development -> Data and parameters -> Representations

Enter the representation code, description and class code as shown in below figure. (Note : Instance will be added automatically.)

Go to Managed behaviors block in the “General” tab and ensure creation, update and deletion checkboxes are checked active or not, if not make them “Active”.

Next, go to the “Organization” tab, create sections and blocks as shown below, later on you will see how they will look when the user opens the representation.

Now, go to the “Displayed properties” tab and click on the action button (3 dots) and select “selection” option and the below screen will appear.

Select “Query” , “Detail”, “Edit”, “Enterable” options as “Yes” and “Initial status” as “Visible” and then click on the “OK” button.

The user will be able to see the below screen and can select the block wanted to be displayed on whether header or detail facet.

In future if needed to add more fields in the table, they can be added similarly as above in the classes and representations.

Click on “Save”, “Validation” and then “Global Validation” for effecting the changes done in representation.

Next, create a menu item with “Link Type” as “Representation” , in “Representation” option , enter the representation code (here “YRTEST”) and in “Entity” option, enter the class code (here “YCTEST”) and add it in the navigation pages where the user wants to be accessed.

After clicking on the menu item, the user will be able to see the below screen where the user can create and edit the records with header & detail information.

In this way, the user can perform CRUD operations using classes and representations without creating screens and objects.

This blog helps us to understand how the user can perform CRUD operations using classes and representations without creating screens and objects.

About Us
Greytrix – a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix caters to a wide range of Sage X3 (Sage Enterprise Management) offerings – a Sage Business Cloud Solution. Our unique GUMU™ integrations include Sage X3 for Sage CRM, Salesforce.com and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3 (Sage Enterprise Management). Currently we are Sage X3 Implementation Partner in East Africa, Middles East, Australia, Asia. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight and Letter of Credit for Sage X3 to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information on Sage X3 Integration and Services, please contact us at mailto: x3@greytrix.com. We will be glad to assist you.