Thursday, May 18, 2017

Unable to deploy AX2012 Azure Virtual Machine

There is a AX 2012 virtual machine available on the Azure Portal.  When I tried to create one, I received the following error (with typo):

Project was created but there were problems creating deployment instance. You need to be a service administrator or co-administator for the selected Azure subscription or the location selected may not be supported for deploying Microsoft Dynamics AX 2012 R3 instances.


This happens because Azure environment does not trust Lifecycle Services.
  1. Open Lifecycle services to the project you tried to use
  2. Go to Microsoft Azure settings
  3. Download the management certificate
  4. Open the old Azure Management portal.
  5. Go to Settings > Management Certificates
  6. Upload the certificate.
  7. Go back to Lifecycle services and click the plus sign to create an environment and follow the steps.

Wednesday, May 10, 2017

Finding invalid document handling references

static void listDocuHandling_InvalidPaths(Args _args)
{
    DocuRef                 docuRef;
    DocuValue               docuValue;
    SysOperationProgress    progress;
    Common                  common;
    ;
    setPrefix("Invalid document handling file references");

    // Initialize progress indicator
    select count(RecId) from docuRef;
    progress = new SysOperationProgress(1, true);
    progress.setTotal(docuRef.RecId);
    progress.setCaption(funcname());

    while select docuRef
    join docuValue
    where docuValue.RecId == docuRef.ValueRecId
    {
        progress.setText(docuRef.Name);
        common = docuRef.refCommon();
        setPrefix((docuRef.Name) ? int642str(docuRef.RecId) + ' - ' + docuRef.Name : int642str(docuRef.RecId));

        if (!common.RecId)
        {
            error(strfmt("Referenced record %1 in %2 does not exist", docuRef.RefRecId, docuRef.refTablename()));
        }

        // Check if the file exists
        if (docuRef.docuType().FilePlace != DocuFilePlace::Database
         && !WinAPI::fileExists(docuValue.Path + docuValue.fileName()))
        {
            info(docuValue.Path + docuValue.fileName());
            if (common.RecId)
                info(common.caption(), strMin(), SysInfoAction_TableField::newBuffer(common));
        }
        progress.incCount();
    }
    progress.kill();
}

Friday, May 5, 2017

Work item could not be created. Insufficient rights for user

There are 60 workflows available within AX and it can be frustrating to try and set up specific security for each one.  The following message is no exception (pun).

Symptom
Stopped (error): X++ Exception: Work item could not be created. Insufficient rights for user cluther.
 at SysWorkflowWorkItem-create
SysWorkflowWorkItem-createWorkItems
SysWorkflow-save
SysWorkflowQueue-resume
SysWorkflowMessageQueueManager-executeTask
SysWorkflowMessageQueueManager-run

Details
Throws the error from \Classes\SysWorkflowWorkItem.create() line 155

Approach
Add the following warning messages to the SysWorkflowDocument so that AX explicitly tells you what access is required in order to run the workflow.