How to get User Details using COMAPI in C#

By | January 29, 2021

We are aware that in Sage 300 database there are no such tables provided to get to know the details of the Users created in the Sage 300 ERP and also in all other sage 300 tables we only have user id information saved about the user. But many of the customers who need the export reports of transactions expect the user name in the report rather than the user id and may also need some other details about the user such as role,phone,email,etc. During development of such export utility programmer may come across situation where they cant find the table to get the user details in sage 300 database.

So, in this blog, we will discuss about how to get the user details such as username,role, phone,email using the COMAPI through the accpaview.

New Stuff: E-Invoicing in Sage 300 ERP

Step 1:

Include the Sage 300 COMAPI in the project.

Step 2:

Once the COMAPI DLL is included, create the object of the DBLink and open the DBLink object using the session object .

AccpacCOMAPI.AccpacDBLink DBLinkCmpRE=
mSession.OpenDBLink( AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY,
AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);

Step 3:

Open the accpacview ‘AS0003’ using the DBLink and assign the USERID(e.g. – ADMIN) to the accpacview of which we need to fetch details.

AccpacCOMAPI.AccpacView ASUSER1;
AccpacCOMAPI.AccpacViewFields ASUSER1Fields;

DBLinkCmpRE.OpenView(“AS0003”, out ASUSER1);
ASUSER1Fields = ASUSER1.Fields;
ASUSER1Fields.Item(“USERID”).PutWithoutVerification(“ADMIN”);

Step 4:

Now we call the browse and Fetch method to return the records of the respective userid.

string res = “”;
ASUSER1.Browse(“”, true);
ASUSER1.Fetch();
res = ASUSER1.Fields.Item(“USERNAME”).get_Value();

Using the above script we can also get other user details such as role,phone,email,etc based on the fields in the ‘AS0003’ accpacview.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged 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 competence.

Greytrix offers unique GUMU™ integrated solutions of  Sage 300 with Sage CRM, Salesforce(listed on Salesforce Appexchange), Dynamics 365 CRM and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration services for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and for Sage 300c development services we offer, upgrades of older codes and screens to new web screens, latest integrations using Data and web services  to Sage business partners, end users and Sage PSG worldwide.

Greytrix offers 20+ addons for Sage 300 to enhance productivity such as GreyMatrixDocument AttachmentDocument NumberingAuto-Bank ReconciliationPurchase Approval SystemThree way PO matchingBill of Lading and VAT for Middle East. The GUMU™ integration for Dynamics 365 CRM – Sage ERP is listed on Microsoft Appsource with easy implementation package.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

For more details on Sage 300 and Sage 300c Services, please contact us at accpac@greytrix.com, We will like to hear from you.

Related Posts:-
1.How to use BlkPut to save data into Sage 300 using COMAPI in C#
2.How to use BlkGet to fetch data from Sage 300 using COMAPI in VB6.0
3.How to use BlkGet to fetch data from Sage 300 using COMAPI in C#
4.Sage 300 view to read data using COMAPI in VB6.0