Thursday, 13 July 2017

To Keep password while logging into AX application

To keep a password while logging into AX,
Use the first method that is called while logging into AX. i.e,
Application(Class) > startuppost() method.

void startupPost()
{
dialog d;
dialogfield df, df1, df2;
userinfo user;
boolean ret;
;
d = new dialog(“Password”);
df = d.addField(typeid(userid),”UserName”);
df1 = d.addField(typeid(userid),”UserName”);
df2 = d.addField(typeid(string30),”Password”);
df.value(curuserid());
select user
where user.id == curuserid();
if(user)
{
df1.value(user.name);
}
df1.allowEdit(false);
df1.displayLength(25);
while(d.run())
{
if(!(df2.value() || df2.value() == ‘Suri’))
{
infolog.shutDown(true);
throw error(“wrong password”);
df2.doNull();
continue;
}
else
{
ret = true;
break;
}
}
if(ret == false)
{
infolog.shutDown(true);
}
}

Wednesday, 5 July 2017

Print Middle Data in a field Data in AX2012



static void Job40(Args _args)
{

   
    str firstvalue,finalvalue,a = "ABC";
    info(strRem("ABCD", "C"));
    info(subStr("ABCD", 1,1));
   
    firstvalue = subStr(a,2,2);
   
    finalvalue = strRem(a, firstvalue);
   
    info(finalvalue);
   
}


IN SSRS:

Declaration:
str                         firstvalue,finalvalue,a;

Inside the loop:

 a = SalesPurchInvoiceHeaderFooterTmp.GSTConsignee;
    firstvalue = subStr(a,3,10);
    
    SalesPurchInvoiceHeaderFooterTmp.GSTConsigneePan = firstvalue;
    
    //info(strFmt("%1", firstvalue));
    
    finalvalue = subStr(SalesPurchInvoiceHeaderFooterTmp.GSTBuyer,3,10);
    
    SalesPurchInvoiceHeaderFooterTmp.GSTBuyerPan = finalvalue;