사용자에게 연결된 Role과 Task 정보를 파일로 저장

Posted by Alvin You
2013. 11. 18. 13:21 Dynamics AX

static void UserRolesAndTasks(Args _args)

{

    System.IO.StreamWriter sw;

    InteropPermission perm = new InteropPermission(InteropKind::ClrInterop);

    SecurityTask            securityTask            ;

    SecurityRole            securityRole            ;

    SecurityUserRole        securityUserRole        ;

    SecurityRoleTaskGrant   securityRoleTaskGrant   ;

    UserInfo                userInfo                ;

    str                     outputText              ;

    ;

 

    perm.assert();

 

    sw = new System.IO.StreamWriter(@"C:\RolesAndTasks.txt");

    CodeAccessPermission::revertAssert();

 

    info( "User|Role|Task");

    while select securityUserRole

            join securityRole           where securityRole.RecId                    == securityUserRole.SecurityRole

            join securityRoleTaskGrant  where securityRoleTaskGrant.SecurityRole    == securityRole.RecId

            join securityTask           where securityRoleTaskGrant.SecurityTask    == securityTask.RecId

            join userInfo               where userInfo.id                           == securityUserRole.User

                                           && userInfo.enable                       == NoYes::Yes

    {

        outputText = strFmt("%1 |%2 | %3" , securityUserRole.User, SysLabel::labelId2String2(securityRole.Name), SysLabel::labelId2String(securityTask.Name));

        sw.WriteLine(outputText);

    }

   

    sw.Flush();

    sw.Close();

    sw.Dispose();

   

    info( "done");

}

사용자가 AX 2012 화면 구성을 바꾸지 못하도록 막는 방법

Posted by Alvin You
2013. 11. 14. 13:29 Dynamics AX

AX 기본 화면 또는 개발된 화면의 사용자 커스터마이제이션을 막는 방법은 아래와 같이 AllowUserSetup 속성을 No로 설정을 하면 가능합니다. 아래 화면은 AllowUserSetup 속성을 No로 변경 후 Personalize 화면에 들어갔을때 보여지는 화면입니다.

 

Sort를 막는 방법은 해당 Grid Column의 Sort() 메서드를 Override받은 후 해당 Method의 내용을 주석 처리하면 됩니다.

 

public int sort(SortOrder _sortDirection)
{
    int ret;

//    ret = super(_sortDirection);

    return ret;
}

 

 

Updated: October 11, 2008

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Disabling user customization is the lowest level that can be set for User Personalization of Forms. This level requires that you set the AllowUserSetup property on the form control, and set the AllowAdd property on the form data source field to No.

In this mode, only the size and position of the form can be changed. Users cannot change properties on the individual controls.

Because the position and size of the form is saved (the size is saved if the SaveSize property is set to Yes), there is an entry for this form in the SysLastValue table. No personalization is allowed.

This personalization level is relevant in forms that have a fixed size and whose control positions are important. Examples are wizard forms and forms used for touch-sensitive screens. Use of this personalization level also ensures that users cannot hide information in a particular form.

NoteNote

If you use the AllowUserSetup and AllowAdd properties to prevent user customizations, it affects all users of the form. If customization should be set at run time on a per-user group basis, use the SecurityKey property on the menu item for the form or on individual form controls.

Excel 파일을 열어서 값 가져오기

Posted by Alvin You
2013. 11. 13. 15:37 Dynamics AX

아래코드는 Excel 파일을 열어서 원하는 Cell 위치의 값을 가져와서 뿌려주는 샘플 코드입니다.

 

static void OpenExcelApp(Args _args)
{
    SysExcelApplication ExcelApp;
    str cellValue;
    ;

    ExcelApp = SysExcelApplication::construct();
    ExcelApp.workbooks().open('C:\\text.xls');

    cellValue = ExcelApp.activeSheet().cells().item(1,1).value().toString();

    info(strFmt("Value of cell A1 = %1", cellValue);
}

 

AX Query에서 사용하는 like operator

Posted by Alvin You
2013. 11. 13. 14:58 Dynamics AX

AX Engine에서 사용되는 Query 작성시 사용할 수 있는 Like 연산자 사용방법에 대한 예제입니다.

 

static void likeOperator(Args _args)
{
    DirPartyTable dirPartyTable;
    ;
 
    select dirPartyTable where dirPartyTable.Name like("*Pusan*");// match with Pusan
    info(dirPartyTable.Name);   
    select dirPartyTable where dirPartyTable.Name like("*Pusan");// end with with Pusan
    info(dirPartyTable.Name);   
    select dirPartyTable where dirPartyTable.Name like("Pusan*");// start with Pusan
    info(dirPartyTable.Name);
}

Data Migration Framework

Posted by Alvin You
2013. 11. 13. 14:02 Dynamics AX

AX 2012의 DMF(Data Migration Framework)에 대한 요약 내용입니다. AX 2012 출시 이후 많은 Business Partner사들이 Excel Addin을 통해 잘못된 Data Migration 작업을 시도하면서 MS에서 발빠르게 준비해서 나온 Data 이관 솔루션입니다.

 

Data Migration Framework within Microsoft Dynamics AX 2012

AX 2012 Model store database and baseline model store

Posted by Alvin You
2013. 11. 13. 13:24 Dynamics AX
Model store database
The model store is the database where all application elements for Microsoft Dynamics AX are stored. Customizations are also stored in the model store. The model store replaces the Application Object Data (AOD) files that were used in earlier versions of Microsoft Dynamics AX.

Baseline model store
The baseline model store holds model store tables for the earlier version of the metadata and is used only during upgrade. The baseline model store is like the old folder in earlier versions of Microsoft Dynamics AX.

Note : In Microsoft Dynamics AX 2012 R2, the model store was moved into a database that is separate from the business database.

Assign users to roles based on the Rule

Posted by Alvin You
2013. 11. 6. 23:13 Dynamics AX

AX 2012의 Role&Security 정의는 생각보다 까다롭다는 이야기를 많이 합니다. 그만큼 Role 정의도 많아졌고, 세부적인 권한 설정까지 정의 하기 위해서는 많은 준비와 시행착오를 감수해야 하기 때문일 것 같습니다.

특히 국내에 보급된 ERP의 메뉴 정의와 권한 셋팅에 익숙해져 있는 국내 IT 관리자들에겐 MS Dynamics AX의 권한 셋팅은 쉽지 않은 작업이라고 생각이 듭니다.

 

오늘은 권한 셋팅 방법 중 하나인 규칙 기반의 Role 할당 방법에 대해서 간략하게 설명을 하려고 합니다.

미리 정의된 직급,직책,부서 단위로 설정된 Query를 통해 관련 사용자 목록을 가져와 자동적으로 연결된 Role에 맵핑을 시켜주는 방법입니다.

 

메뉴 위치 : System Administration >> Setup >> Security >> Assign users to roles

 

Add Rule 버튼을 통해 아래와 같이 미리 정의된 Query문을 가져올 수 있습니다. Query를 추가 하는 방법은 나중에 따로 올리도록 하겠습니다. 아래 Query3를 보시면 별도의 작업을 통해서 추가 할 수 있는걸 확인하실 수 있습니다.