giovedì 10 agosto 2023

How to extend the Dialog class in D365 FFO

How to extend the standard class DIALOG in order to use in different points the custom methods(like lookup, validation etc).
It can be useful to use methods and standardize the code.

class MyCustomDialog extends Dialog

  public void my_lookupCustom(FormControl _callingControl )
  {
  // some code
  }
  boolean my_validateCustom(FormControl _callingControl)
  {
    // some code
  }
  boolean my_CustomGenericMethod(FormControl _callingControl)
  {
     // some code
  }
}

How to use the custom methods:

MyCustomDialog dialog; // use my custom class

dialog = new MyCustomDialog("TEXT");
dialog.addText("Some text");
dialog.my_CustomGenericMethod(....) ; 

Another way to use the custom methods:

// other example
 fieldSite.registerOverrideMethod(methodStr(FormStringControl, validate),
                                  methodStr(MyCustomDialog , my_validateCustom), dialog); 

Below how appear:




We can create different methods to meet our needs.

enjoy

sabato 24 giugno 2023

D365FO - KIT management

 In D365Fo there is a standard embedded kit management. It is reachable at the following menu Retail and Commerce.


Three functions are available in that place:

-    Product kits

-    Released product kits

   Kit orders


The first function allows the generation of a product having the flag kit activated as reported below.


Clicking on the button Configure in the button group Product kit, it's possible to define all the components the kit is made of.


Once the kit is approved, it will automatically generate a new variant related to the product master, usable everywhere in the system (it is then visible in the menu Released product kits).

For producing instead a Kit it is required to access the Kit order menu previously mentioned.


Once the warehouse is defined and the quantities to be produced, clicking on the button Post the system will consume the components and produce the kitted product (this function will use a BOMJournal to perform this activity).


venerdì 16 giugno 2023

How to find all D365 Security ROLES inheritance relations?

 

Is just a starting point

How can we catch all security relations OnPrem/Cloud environment? (also considering changes made by Security Configuration in Security Module)

It can be useful to know all the objects that have a relationship to the security role.

  • First a quicky recap:

The security AX2012/D365 consists of in three main elements:

The security inheritance – relations is like belog

The common security role tree is like below

A common issue or request is to find all relations about objects, to better understand how role work

-         which are the related duties?

-         which are the related privileges?

-        I need to know all security role dependency

....and others...

By SQL script we can find all security object references.

Table SECURITYOBJECTCHILDREREFERENCES can help us.

The main tables:

SECURITYPRIVILEGE

SECURITYDUTY

SECURITYROLES

SECURITYOBJECTCHILDREREFERENCES

Also the table SECURITYOBJECTCHILDREREFERENCES can be used for others query/relations

Run SQL scripts:

 -- All Privileges

select * from SECURITYPRIVILEGE

-- All Duty

select * from SECURITYDUTY

-- All Roles

select * from SECURITYROLES


HOW TO GET ALL SECURITY REFERENCES

  1. Get the list of all security roles with its duties

SELECT T2.Name as SecurityRole, T3.NAME as Duty
FROM SECURITYOBJECTCHILDREREFERENCES T1
JOIN SECURITYROLE T2 ON T1.IDENTIFIER = T2.AOTNAME
JOIN SECURITYDUTY T3 ON T1.CHILDIDENTIFIER = T3.IDENTIFIER
WHERE T1.OBJECTTYPE = 0 AND T1.CHILDOBJECTTYPE = 1

2. Get the list of all security roles with its privileges

SELECT T2.Name as SecurityRole, T3.NAME as Privilege
FROM SECURITYOBJECTCHILDREREFERENCES T1
JOIN SECURITYROLE T2 ON T1.IDENTIFIER = T2.AOTNAME
JOIN SECURITYPRIVILEGE T3 ON T1.CHILDIDENTIFIER = T3.IDENTIFIER
HERE T1.OBJECTTYPE = 0 AND T1.CHILDOBJECTTYPE = 2 

3. Get the list of all role-duty combination with privilege 

SELECT T2.Name as SecurityRole, T2.AOTNAME as RoleSystemName,  T3.NAME AS Duty, T3.IDENTIFIER as DutySystemName, T5.NAME as Privilege, T5.IDENTIFIER as PrivilegeSystemNam
FROM SECURITYOBJECTCHILDREREFERENCES T1
JOIN SECURITYROLE T2 ON T1.IDENTIFIER = T2.AOTNAME
JOIN SECURITYDUTY T3 ON T1.CHILDIDENTIFIER = T3.IDENTIFIER
JOIN SECURITYOBJECTCHILDREREFERENCES T4 on T4.IDENTIFIER = T3.IDENTIFIER
JOIN SECURITYPRIVILEGE T5 on T4.CHILDIDENTIFIER = T5.IDENTIFIER
WHERE T1.OBJECTTYPE = 0 AND T1.CHILDOBJECTTYPE = 1
AND T4.OBJECTTYPE = 1 AND T4.CHILDOBJECTTYPE = 2

Examples:

Duties related to role "SystemUser"

Privileges related to role "SystemUser" (by direct relation)

Privileges related to Role through Duties

enjoy

domenica 14 maggio 2023

D365FO - Cluster management in mobile warehouse product receipt process

 There is the option in D365FO to manage clusters while receiving goods, in order to define a path for performing the put away procedures or to just collect more put away together (just applicable in case we are managing receipt and put away in two different steps).

In order to manage it, we have to switch on in the receipt function the flag assign putaway cluster.


Then it is required to define a cluster profile as follows, defining when and how a cluster will be generated and the lines ordered in it, and to which work template it will be related.


The following menu item will be defined in the mobile app in order to manage the closure of the cluster.


In the putaway menuitem we must define that we want to proceed scanning the cluster id each time (defined in the field Directed by), as follows.



Perform the receipt on the mobile app.


At the closure of the receipt of each line we can define a new cluster id (as reported below).


Access the form for closing the clusterid, after scanning it click on the button close cluster as reported below.



Access the putaway function on mobile app as follows.


Scan the cluster and move the items to the final location.



sabato 13 maggio 2023

D365FO - Detour steps in WMS

 It is needed to create before everything a new menu item for WMS having the following parameters.


Mode should be set as Indirect, Activity code as Data inquiry and a table for lookup must be set (for instance Purchtable).

Then it is required to define mobile device steps as follows (let's assume we want to add a view of the purchase orders while scanning the purchase order id while performing the product receipt).  (Before performing this step the default setup must be automatically created clicking on the button Create default setup).


Once chosen the right stepid, it is needed to click on Add step configuration, and choose a menu item where we want to apply the detour.


Once done we have to add the detours to the step we are creating, clicking on the button Add in the bottom part of the form.


Then we choose the detour to be added from a list.


Then we have to define the field to be sent and received with the detour function (make sure you have created the default fields for all the functions using the Menuitem Warehouse app field names).



The mobile app function will then appears as follows.






lunedì 24 aprile 2023

D365 FFO - Aggiungere campo multiselect lookup

In questo post vediamo come aggiungere un campo di tipo lookup-multiselect  che punta alle delivery modes ad una form STD (CustParameters nel nostro caso). Ho trovato in giro diverse soluzioni, quella che mi sembra logicamente più corretta è quella di memorizzare i valori selezionati in una tabella dedicata, piuttosto che scrivere i valori sul controllo unbound stesso.

1) Per prima cosa creiamo una tabella che conterrà i recId delle delivery mode selezionate.La tabella che chiameremo LILCustParametersDlvMode conterrà quindi un campo "DlvModeRecId" chiave primaria



2) Aggiungiamo ora un controllo di tipo string alla form CustParameters nel tab general e settiamo le seguenti proprietà:

  • Autodeclaration = Yes
  • Name = CustParameters_DlvModes
  • Filter Expression = %1
  • Label = @SYS210

3) Creare un oggetto query avente come datasource la tabella DlvMode e come campi Code e Txt



4)Creare una classe CoC che chiameremo LILCustParametersForm_Extension per estendere la form cust parameter:

 [ExtensionOf(formStr(CustParameters))]  
 final class LILCustParametersForm_Extension  
 {  
   private SysLookupMultiSelectCtrl        msCtrlDlvMode;   
   
   //effettual il binding dei valori tra il campo e la tabella LILCustParametersDlvMode  
   void bindCustParametersDlvMode()  
   {  
     container            catalogIds, catalogValues;  
     LILCustParametersDlvMode    custParametersDlvMode;  
     DlvMode             dlvMode;  
     container            dlvModeIds,  
                     dlvModeValues;  
   
     while select custParametersDlvMode  
       join dlvMode  
       where dlvMode.RecId == custParametersDlvMode.DlvModeRecId  
     {  
       dlvModeIds   += [dlvMode.RecId];  
       dlvModeValues  += [dlvMode.Code];  
     }  
   
     msCtrlDlvMode.set([dlvModeIds, dlvModeValues]);  
   }  
   
   public void saveDlvMode()  
   {  
     int                 counter;  
     RecId                recId;  
     LILCustParametersDlvMode      custParametersDlvMode;  
   
     container  dlvModes = msCtrlDlvMode.get();  
   
     ttsBegin;  
   
     //elimina i valori preesistenti  
     delete_from custParametersDlvMode;  
         
     //Salva i nuovi valori selezionati  
     for (counter = 1; counter <= conlen(dlvModes); counter++)  
     {  
       recId = any2int64(conpeek(dlvModes, counter));  
   
       if (recId)  
       {  
         custParametersDlvMode.clear();  
   
         custParametersDlvMode.DlvModeRecId = recId;  
   
         custParametersDlvMode.insert();  
       }  
     }  
   
     ttsCommit;   
   }
   
   private void initAndBindCustParametersDlvMode()
   {
       msCtrlDlvMode = SysLookupMultiSelectCtrl::construct(this, CustParameters_DlvModes, queryStr(LILDlvModeQuery));

       this.bindCustParametersDlvMode();
   }
   
   public void init()  
   {  
     next init();  
   
     this.initAndBindCustParametersDlvMode();
   }  
 }    

5)Sottoscrivere l'evento modified del controllo CustParameters_DlvModes per gestire l'inserimento dei valori:
 class LILCustParametersFormEH  
 {    
   [FormControlEventHandler(formControlStr(CustParameters, CustParameters_DlvModes), FormControlEventType::Modified)]  
   public static void CustParameters_DlvModes_OnModified(FormControl sender, FormControlEventArgs e)  
   {  
     FormRun formRun = sender.formRun() as FormRun;  
   
     formRun.saveDlvMode();  
   }  
 }  

lunedì 17 aprile 2023

Keep CR/LF from SQL Grid to copy

 

It's just a kind suggestion.

Could be happen, copying from SQL grid to text editor the carriage return or line feed are missing

 


Go to SQL TOOLS – Options … ENABLE the flag
Retain CR/LF on copy or save



Open a NEW Tab (in order to load the new parameters), now it works.

 


enjoy