Thursday, January 25, 2018

Welcome Message Before open the ax

When open the ax client to display the welcome message 

follow the two different ways 

One:
 
Goto--> Info Class-->StartupPost method

write what to want to display as a welcome message

void startupPost()
{
   Box::info("welcome to dhanush","DHANUSH","test");
}

                    
                         
Note: it works only for client not for server.




Another Way:: Do the the configuration to Create a configuration file.

Got-->;    Microsoft Dyanamics 2012 configuration--> manage right click--> create configuration                        file-->  in general tab seen startup message in that control write welcome message .
                after creation of configuration file export the file to your pc.




Vendor Merging

static void vendorsMerge(Args _args)
{
    VendTable                                   vendTable;
    VendTable                                   vendTableDelete;
    PurchJournalAutoSummary                     journalSummary;
    RetailVendTable                             retailVendTable;

    DimensionAttributeValue                     dimensionAttributeValue;
    DimensionAttributeLevelValue                dimensionAttributeLevelValue;
    DimensionAttributeValueGroup                dimensionAttributeValueGroup;
    DimensionAttributeValueCombination          dimensionAttributeValueCombination;
    DimensionAttributeValueGroupCombination     dimensionAttributeValueGroupCombination;

    #define.vend('1003')
    #define.vendDelete('US_TX_003')

    ttsbegin;
    delete_from journalSummary
        where journalSummary.VendAccount ==  #vendDelete;
    delete_from retailVendTable
        where retailVendTable.AccountNum == #vend;

    select firstonly forupdate vendTableDelete
        where vendTableDelete.AccountNum == #vendDelete;

    select firstonly forupdate vendTable
        where vendTable.AccountNum == #vend;

    select firstonly forupdate dimensionAttributeValueGroup
        join dimensionAttributeLevelValue
            where dimensionAttributeValueGroup.RecId == dimensionAttributeLevelValue.DimensionAttributeValueGroup
               && dimensionAttributeLevelValue.DisplayValue == #vendDelete;
    dimensionAttributeValueGroup.delete();

    select firstonly forupdate dimensionAttributeValue
        join dimensionAttributeLevelValue
            where dimensionAttributeValue.RecId == dimensionAttributeLevelValue.dimensionAttributeValue
               && dimensionAttributeLevelValue.DisplayValue == #vendDelete;
    dimensionAttributeValue.delete();

    select firstonly forupdate dimensionAttributeLevelValue
        where dimensionAttributeLevelValue.DisplayValue == #vendDelete;
    dimensionAttributeLevelValue.delete();

    select firstonly forupdate dimensionAttributeValueGroupCombination
        join dimensionAttributeValueCombination
            where dimensionAttributeValueCombination.RecId == dimensionAttributeValueGroupCombination.DimensionAttributeValueCombination
               && dimensionAttributeValueCombination.DisplayValue == #vendDelete;
    dimensionAttributeValueGroupCombination.delete();

    select firstonly forupdate dimensionAttributeValueCombination
        where dimensionAttributeValueCombination.DisplayValue == #vendDelete;
    dimensionAttributeValueCombination.delete();

    vendTableDelete.merge(vendTable);
    vendTable.doUpdate();
    vendTableDelete.doDelete();
    ttscommit;
    info("Vendor merging successfull");
}

Tuesday, January 23, 2018

Calling menu item button of form in a class

I want to call a menu item button of the form, from my class.

In a class follow below procedure


// MyFormControllerClass classDeclaration
public class MyFormControllerClass
{
FormFunctionButtonControl formButton;
}
public FormFunctionButtonControl parmFormButton(FormFunctionButtonControl _formButton = formButton)
{
formButton = _formButton;
return formButton;
}
protected void someEventHandler()
{
if (formButton)
{
formButton.clicked();
}
}


To call above class in form init method

// form classDeclaration
public class FormRun extends ObjectRun
{
MyFormControllerClass formController;
}
// form init
public void init()
{
super();
formController = new MyFormControllerClass();
// pass the button reference
formController.parmFormButton(MyFormButtonWithAutoDeclarationYes);
}


Ex: see the class ->  LedgerJournalFormTable.

scenario:: In LedgerJournalTable form i want to disable the post button for perticular user group                           persons.


  Go to LedgerJournalFormTable class in enableButtonsActive method write following code.
 
           while select userGroupList
                     where userGroupList.groupId == "Post Group"
                             && userGroupList.userId == curUserId()
                          {

                              ctrlPostJournalMenu.enabled(false);
                           }


Monday, January 22, 2018

Based on security roles to enable or disable the buttons in a form

static void Dipl_securityrole(Args _args)
 {
      securityrole           role;
      securityuserrole    userrole;
 
       while select * from role
                 join userrole where role.recid == userrole.securityrole
                                       && role.name== 'Dipl_purchtable'
        {
           if(userrole.recid)
           {
              if(curuserid()==userrole.user)
                {
                    //attachments.enabled(false); //attachment is a form button name
                }
 
           }
           else
         {
               // attachments.enabled(true);
            }
           info(strfmt("%1,%2", role.Name,userrole.User));
        }
}

TFS Work space configuration

Refer below link:  https://d365byjp.blogspot.com/2018/10/steps-to-configure-tfsvsts-workspace-in.html