Wednesday, March 20, 2019

Reference Group Control lookup in D365

This post shows how to create lookup for ReferenceGroupControl using extensions.

All we need to do is to register event handler for lookup function and make a lookup little bit differently as shown below.


After handler is registered use the following code.

[FormControlEventHandler(formControlStr(MyWorker, MyWorker_HcmWorkerRecId), FormControlEventType::Lookup)]
public static void MyWorker_HcmWorkerRecId_OnLookup(FormControl sender, FormControlEventArgs e)
{
    MyClass::createLookup(sender);

    FormControlCancelableSuperEventArgs cancelableArgs = e as FormControlCancelableSuperEventArgs;
    cancelableArgs.CancelSuperCall();
}

private static void createLookup(FormReferenceGroupControl _ctrl)
{
    SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tablenum(HcmWorker), _ctrl);
    Query                   query = new Query();

    sysTableLookup.addLookupfield(fieldNum(HcmWorker, PersonnelNumber));
   
    query.addDataSource(tablenum(HcmWorker));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Changin NewRecordAction through extensions

In this post we will discuss how to change NewRecordAction property using extensions in D365 for Finance and Operations.

As you know NewRecordAction property is not enabled when being used in extensions as shown in the picture below.


Resolution: 

This can be achieved by capturing onInitialized form handler event as shown below.


Thursday, February 7, 2019

How to get D365 environment URL from LCS

This post shows how to get D365 for Finance and Operations environment URL from LCS.

As shown in the picture below, logon to environment, click Login and select Log on to environment.


Tuesday, January 29, 2019

How to connect UAT database using SQL Server Management Studio

In this post I am will demonstrate how to connect to UAT database (Azure) in SQL server management studio unlike DEV environment where database sits on same box.

Following are the steps involved in connecting SQL server management studio to UAT database:

Step 1:
Go to your environment page in LCS and scroll down to database accounts sections under Manage Environment tab.


Step 2:
Open SQL Server Management Studio in UAT environment and put the highlighted SQLServer\Databasename in Server name box with addition to ".database.windows.net" as shown below


Step 3:
Set the Authentication mode to SQL Server Authentication, get the password from environment page under database accounts section and hit Connect.


You are now connected to UAT database.