Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Wednesday, May 7, 2014

Generate random password in Dynamic AX

Hi,

Just like OTP (one time password) for email this below code generates for alphabet.

static void Generate_Password_Random()
 {
     int i;
     RandomGenerate random = new RandomGenerate();
     str password;
     int passwordLength = 8;
     ;

     for (i=1; i<= max(2, passwordLength); i++)
     {
         if (i mod 2)
             password += num2char(random.randomInt(char2num('a', 1), char2num('z', 1)));
         else
             password += num2char(random.randomInt(char2num('0', 1), char2num('9', 1)));
     }

     info(password);
 }

Code to get the line no to grid in Dynamic AX

Hi,

use below code in the create method of the form in data source level.

 select maxOf(SequenceNumber) from dNPhaseLoc where dNPhaseLoc.DNModularID == DNModule.DNModularID;
 if(DNPhase)
      DNPhase.SequenceNumber = dNPhaseLoc.SequenceNumber +1;
  else
        DNPhase.SequenceNumber = 1;

//Just add SequenceNumber as interger field for your table with reference to header datasoure record you need to use where clause.
Thus line no will be created.

Regards,

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...