Tuesday 29 October 2013

Create New user in Active directory

How to create Active Directory Users:
Administrator Tools >>  Active Directory Users and Computers
Click on User >>  To create new user in Active Directory ..
Once you create user then only you can add user to AX...

Click on the user you created for ex: sujju - RC on it >> properties..
Click on Member of - you must include administrator permission, to get administrator permissions to the user.

Else ax will not be open due to no granted permissions.

Thursday 17 October 2013

Security in AX

Security Keys in Ax



Dynamics Ax provides following keys to provide the security for application

1.License Keys :
First Level Security , specifies what all featues/modules/developemnt tools we can access in the standard product.License Keys will be used after installation to unlock the product.License Keys will be issued by the microsoft for partners/vendors to develop vertical/generic solutions.

2.Configuration Keys :
Second Level Security , To Enable/Disable the object/feature for all the users.

3.Security Keys :
If you want to enable/disable object/features to group of users.

4. Record Level security :
Basically it deals with the data , if you want to restrict the viewing of records per user group than we setup record level security.
 ========================================================================

Roles – These are the security roles that you create to assign to users.  These are typically going to be created around jobs/positions that exist within the organization.  An example of this is the Accounts Payable clerk role.
Duties – I like to think of duties as tasks, specifically the tasks that you would need to do as part of your job/position which are considered roles in Dynamics AX.  An example of this would be ‘Maintain vendor invoices’ which is assigned to the Accounts Payable Clerk role.
Privileges – These are the specific forms, reports, etc that a user needs to perform a task and the level of access that is required.  Permissions are made up of entry points and the level of access.  Entry points are menu items (forms, reports, actions), web, services.  An example would be the ‘VendTransMaintain’ privilege that is part of the ‘Maintain vendor invoices’ duty.
Code Permissions – These are used when you have a menu item that is running a method of a class.  Code Permissions allow you to specify access levels to forms, tables, web controls, and reports that are related.  On example of this would be the VendEditInvoice code permission which deals with the executeTransfer method of the subledgerJournalTransferOperation class.  It also involves permissions to the VendEditInvoice form.
Process Cycles – These are used to group duties together so that it is easier to find them when searching in the Dynamics AX client to create or modify a role.  For example, let’s say you are trying to add the Approve Vendor Invoices duty to the Accounts Payable Clerk role. It is easy to use process cycles because the find feature is available, as opposed to if you try to use the Duty/privilege view by option as the find is greyed out.
Policies – These are used to restrict what data a user is able to see in a form or report.  This is the new method in Dynamics AX 2012 to limit data similar to what you have with record level security.  With this feature you create a query with restrictions.  Then, you create a security policy that can be applied to a security role.  For example, if you wanted to limit your account payable clerks from seeing retail vendors, you could create a query on the vendor group table with a range that limits the retail vendors.  You would then create a policy that includes this query and security role.
=======================================================================================

http://technet.microsoft.com/en-us/library/aa570084.aspx ---> record level security...
 http://axwonders.blogspot.in/2012/03/ax-2012-security-for-developers-part-i.html - code permission...
http://dynamicsaxbox.blogspot.in/2013_02_01_archive.html - table level security
=======================================================================

How to get Multiple Select Lookup in form


How  to get Multiple Select Lookup in form :

Class Declaration of Form :
SysLookupMultiSelectCtrl msCtrl;
In  Data Source Execute query :
#define.seperator(', ')
    container c,v;
    int i;
    boolean first;
    Name allPackIds;
 
  v = msCtrl.getSelectedFieldValues();
 
        first = true;
        for (i = 1; i <= conLen(v);i++)
        {
             if(first)
                {
                    first = false;
                    allPackIds = conPeek(v,i);
                }
            else
                allPackIds += ( #seperator + conPeek(v,i));
        }
 
   if(Amenities.valueStr())
        qbrAmenities.value(allPackIds);
    else
    {
       qbrAmenities.value(SysQuery::valueUnlimited());
    }
 
 
Init of Form :
msCtrl = SysLookupMultiSelectCtrl::construct(element, Amenities, querystr( AmenitiesQuery));
Amenities – Ctrl name in form .
 
In  Modified method :
    RentalInquiryTmp_ds.executeQuery();
    RentalInquiryTmp_ds.refresh();
    RentalInquiryTmp_ds.reread();
 

Tuesday 15 October 2013

Form Method calling Sequence in Dynamics AX

Form Method calling Sequence in Dynamics AX
This gives the information of method calls in the form level while
          1. Opening the Form.
          2. Creating/Updating/Deleting the record in the Form.
          3. Closing the Form.
Sequence of Methods calls while opening the Form
Form — init ()
Form — Datasource — init ()
Form — run () 
Form — Datasource — execute Query ()
Form — Datasource — active ()
Sequence of Methods calls while closing the Form
Form — canClose ()
Form — close ()
Sequence of Methods calls while creating the record in the Form
Form — Datasource — create ()
Form — Datasource — initValue ()
Table — initValue ()
Form — Datasource — active ()
Sequence of Method calls while saving the record in the Form
Form — Datasource — ValidateWrite ()
Table — ValidateWrite ()
Form — Datasource — write ()
Table — insert ()      
Sequence of Method calls while deleting the record in the Form
Form — Datasource — validatedelete ()
Table — validatedelete ()
Table — delete ()
Form — Datasource — active ()
Sequence of Methods calls while modifying the fields in the Form
Table — validateField ()

Table — modifiedField ()

Form spitter code



Form Method
Class Declaration
 public class FormRun extends ObjectRun
{
NumberSeqFormHandler numberSeqFormHandler;
SysFormSplitter_Y _formSplitter;
}
 public void init()
{
;
super();
_formSplitter = new SysFormSplitter_Y(VerticalSplitter,Header,element);
}

Design Group Tool
MouseDown:
int mouseDown(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
 ret = super(x, y, button, ctrl, shift);
 Return _formSplitter.mouseDown(x, y, button, ctrl, shift);
}

Mouse Up
int mouseUp(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
 ret = super(x, y, button, ctrl, shift);
 Return _formSplitter.mouseUp(x, y, button, ctrl, shift);
}
 Mouse Move
int mouseMove(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
 ret = super(x, y, button, ctrl, shift);
 Return _formSplitter.mouseMove(x,y,button,ctrl,shift);
}

Number sequence - 2012



Creating a number sequence-
1.       Create an EDT-CustomerID-  AOT >> Extended Data Types >> New  >> Properties >> Name  >> CustomerID.
2.       Create a  table , Drag EDt(CustomerID). In the field node of dat table .
3.       Go to classes –(num seq (by default ))->NumSeqModuleNetRMs>>
4.       Write the below code
                         protected void loadModule()
            {
              NumberSeqDatatype datatype = NumberSeqDatatype::construct();
//Added by santosh
       datatype.parmDatatypeId(extendedtypenum(customerID));//(keep ur (EDT)/
      datatype.parmReferenceLabel(literalstr(“RES-customerID”));
      datatype.parmReferenceHelp(literalstr(“RES-customerID”));
      datatype.parmWizardIsContinuous(true);
     datatype.parmWizardIsManual(NoYes::No);
     datatype.parmWizardIsChangeDownAllowed(NoYes::No);
     datatype.parmWizardIsChangeUpAllowed(NoYes::No);
     datatype.parmWizardLowest(1);
     datatype.parmWizardHighest(99999999);
     datatype.parmSortField(15);//(change the no to next)//

    datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
    this.create(datatype);
    //code end
              }
After this go to tables net rms parameters (as per the module) and write the below code.
static client server NumberSequenceReference customer()
{
    return NumberSeqReference::findReference(extendedtypenum(customerID));
}
 >>After dis go to jobs and run the below codes
Job1.
 static void NumberSeqModuleVendor(Args _args)
{
    NumberSeqModuleVendor obj = new NumberSeqModuleVendor();

    obj.load();
}
 5.   go to organization administration.
  6.number sequence>>Generate>>Wizard will appear click on next until finish.
 7.  after Wizard change area and reference based on module  and reference on EDt(CustomerID),company.
As shown below.
7. Change ceu then click on the record.

8. constant ,continuous to (uncheck)

 Job2.
 static void NetvendNumberSeq(Args _args)
{
    NumberSeq  numberSeq;
    StudentID num;
    ;
    numberSeq = NumberSeq::newGetNum(VendParameters::student());
   
    num = numberSeq.num();
    info(num);
}



9.create a form drag table in data source .
10.go to forms>>methods ..new method>>in forms find no Seq (ctrl+s).

 Write the below code in method.

NumberSeqFormHandler numberSeqFormHandler()

{

    if (!numberSeqFormHandler)
    {
       numberSeqFormHandler = NumberSeqFormHandler::newForm(NetRMSParameters::customer().NumberSequenceId,
                                                             element,
                                                             Table2_ds,
                                                             fieldNum(Table2, customerID)
                                                            );
    }
    return numberSeqFormHandler;

}

11. go to classdecleration. Write the below code .

public class FormRun extends ObjectRun
{
    NumberSeqFormHandler numberSeqFormHandler;
}
 12.go to datasource table >>methods write create write delete methods

 13.
As the codes below-
public void delete()
{
    ;
    element.numberSeqFormHandler().formMethodDataSourceDelete();
     super();
}
public void write()
{
    super();
    element.numberSeqFormHandler().formMethodDataSourceWrite();
}
 public void create(boolean _append = false)
{
    ;
    super(_append);
    element.numberSeqFormHandler().formMethodDataSourceCreate();
    }
  To Create a number sequence in table-
 public void initValue()
{
    NumberSeq num = NumberSeq::newGetNum(LedgerParameters::NumRefProd());
    super();
    num.used();
    this.Prod = num.num();
}