Pages

Banner 468 x 60px

 

Monday, March 27, 2017

Get user and time using x++

0 comments
Get user and time using x++ :
   
   
   
Melihat nama computer nya :
// if(_inventTable.inventStandardQty(inventDim.inventDimId) > 0 && xUserInfo::find().id != InventParameters::find().BITUser) // please change User movement in InventParameter
     


Tidak melihat nama computer nya :
    
  if(_inventTable.inventStandardQty(inventDim.inventDimId) > 0 && curUserId() != InventParameters::find().BITUser) // please change User movement in InventParameter
   

static void getCurUsername(Args _args)
    InteropPermission   permission;
    str                 userName;
    str                 userDomain;
    ;
    permission = new InteropPermission(InteropKind::ClrInterop);
    permission.assert();
    userDomain  = System.Environment::get_UserDomainName();
    userName    = System.Environment::get_UserName();
    info(strFmt(@"%1\%2", userDomain, userName));
}

Current user and employee link code:
In AX 2009:
EmplTable::find(SysCompanyUserInfo::find(curUserId()).EmplId);
In AX 2012:
HcmWorker::find(DirPersonuser::findUserWorkerReference(curUserId())).name();

  ttsbegin;
 while select forUpdate localTECCustInOutClaimLine
            where localTECCustInOutClaimLine.TECCustInOutClaimTableRefRecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId
        {
            localTECCustInOutClaimLine.ClaimInJournalId      = inventJournalTable.JournalId;
            localTECCustInOutClaimLine.TECClaimInStatus      = TECClaimInStatus::Received;

            // add by Tyo -(79    OPERATION - Sales return, Trade In  dan Claim supplier In: - Harus ada siapa yang terima di gudang)
            localTECCustInOutClaimLine.TIDReceiptPerson      = DirPersonUser::userId2Name(curUserId());
            // end by Tyo

            localTECCustInOutClaimLine.update();
        }
        ttsCommit;


 ttsbegin;
 select forUpdate localTECCustInOutClaimLine
            where localTECCustInOutClaimLine.TECCustInOutClaimTableRefRecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
       
            InventJournalTable.TECApproved  = DirPersonUser::userId2Name(curUserId());
         InventJournalTable.update();
       
        ttsCommit;



void clicked()
{
    element.PostJournalMovement();

    // add by tyo (Trade in dan Claim supplier In : Harus ada siapa yang terima di gudang)
        ttsBegin;
            while select forUpdate TECTradeInTable
            {
                TECTradeInTable.TIDTradeInReceiptPerson = DirPersonUser::userId2Name(curUserId());
                TECTradeInTable.update();
            }
        ttsCommit;
    // end by tyo

    TECTradeInTable_ds.executeQuery();

    super();
}


atau X++


display PersonName jam_nama_pencetak()
{
    return strFmt('%1 %2', DateTimeUtil::getSystemDateTime(), XUserInfo::find(false, curuserid()).Name);//DirPersonuser::userId2Name(curUserId()));
}


display PersonName jam_nama_pencetak()
{
    return strFmt('%1 %2', DateTimeUtil::getSystemDateTime(), XUserInfo::find(false, curuserid()).Name);//DirPersonuser::userId2Name(curUserId()));
}

0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH