web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Problem: DefaultDim : Set Int64 = DefaultDimension

(0) ShareShare
ReportReport
Posted on by

Hi Folks, hope you are well.

I am reading an existing DD from excel cell as int64.
during debug i see it read as the correct value, no issue here.

I select from my table the object i want to set a new DD for. (employment)

However when I :

emp.DefaultDimension = myInt64;

The DD does not get set.

Any ideas welcome.

many thanks.

K.

 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Problem: DefaultDim : Set Int64 = DefaultDimension

    ah, regarding the FDs not displaying, i believe this to be a mismatch of Dims on my side. resolved. looking. Thanks again!!

  • Community Member Profile Picture
    on at
    RE: Problem: DefaultDim : Set Int64 = DefaultDimension

    Hi again ievgen, thanks for your reply.

    Here are the values, method, results, very interesting by not working just yet.

    NAME: _dd  VALUE: 5637144576  TYPE: int64

    Method:

    private void updateDim(str 10 _id, str 4 _da, int64 _dd)
    {
        HcmWorker           w;
        HcmEmployment       emp, nEmp;
        HcmEmploymentType   eType;
        int                 t;
        CompanyInfo         ci, nCi;
    
        ;
    
        t = strScan(_id,"C",1,0);
        if(t==1)
            eType = HcmEmploymentType::Contractor;
        else eType= HcmEmploymentType::Employee;
    
        select ci where ci.DataArea == _da;
    
        w = HCMWorker::findByPersonnelNumber(_id);
    
        if(w.RecId)
        {
            emp = HcmEmployment::findByWorkerLegalEntity(w.RecId,ci.RecId);
    
            ttsBegin;
    
            if(emp.RecId)   //update DD
            {
                
                emp.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
                emp.selectForUpdate(true);
                emp.reread();
                emp.DefaultDimension = _dd;
                emp.update();
    
                info(strFmt('Info :Update: Worker :%1: Emp :%2: DD :%3:'
                    ,w.PersonnelNumber,ci.DataArea,emp.DefaultDimension));
    
            }
            else        //create new employment
            {
                emp = hcmEmployment::find(HcmWorkerTransition::newCreateHcmEmployment(
                    w.RecId, ci.RecId, eType
                    ,DateTimeUtil::newDateTime(1\1\2015,DateTimeUtil::getCompanyTimeZone())
                    ,DateTimeUtil::maxValue()),true);
    
                emp.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
                emp.selectForUpdate(true);
                emp.reread();
                emp.DefaultDimension = _dd;
                emp.update();
    
                info(strFmt('Info :Created: Worker :%1: Emp :%2: DD :%3:'
                    ,w.PersonnelNumber,ci.DataArea,emp.DefaultDimension));
    
            }
            //ttsAbort;
            ttsCommit;
        }
        else
        {
            info(strFmt('Warning: Worker :%1: not found',_id));
        }
    
    }

    it does now seem to set the DD int64 value, great thanks.
    Just one think i note, when I view the Employment FDs in the Worker History, the FD tast tab displays the following:

    FD_5F00_error.png

    if i open/close the FD fast tab, and/or switch between legal entity employment history, it eventually displays the correct list of FD and their values.

    I'm guessing this is not a major issue, considering the FDs are derived from the default dimension value in the DB, which does appear to be correct. I am slightly concerned to put this into Production :/

    Thanks for you help, as always.

    K.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Problem: DefaultDim : Set Int64 = DefaultDimension

    Can you try to do reared() after emp.selectForUpdate(true); ?

  • Community Member Profile Picture
    on at
    RE: Problem: DefaultDim : Set Int64 = DefaultDimension

    also, if I set

    emp.DefaultDimension = 5123456789

    it will set correctly,

    but as above, when _dd is value 5123456789 the DD will not set.

    thanks again. rgds.

  • Community Member Profile Picture
    on at
    RE: Problem: DefaultDim : Set Int64 = DefaultDimension

    if(emp.RecId)   //update DD

           {

               emp.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);

               emp.selectForUpdate(true);

               emp.DefaultDimension = _dd;  //my int64

               emp.update();

           }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans