Sunday, February 12, 2017

Approve Workflow by Code x++


WorkflowWorkItemTable WorkflowWorkItemTable;

    while select WorkflowWorkItemTable
    where
        WorkflowWorkItemTable.UserId == 'hasan.bi'
    &&  workflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem
    &&  workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
    &&  WorkflowWorkItemTable.RefTableId == tableNum(CPMContractAdvanceRequest)
    {
        WorkflowWorkItemActionManager::dispatchWorkItemAction(
                                    WorkflowWorkItemTable,
                                    "Auto Approve by ADMIN", // comment
                                    'hasan.bi', // << user ID
                                    WorkflowWorkItemActionType::Complete,
                                    "CPMContractAdvanceRequestAppApprove", // << menu item action approval workflow
                                    false); //is not web Menu Item
    }

Sunday, February 5, 2017

CIL generation errors and solutions

thansks blog..

http://axvuongbao.blogspot.com.tr/2013/12/fix-parameter-could-not-be-serialized.html


Fix some errors from: CIL generation, Database Synchronize in AX 2012

1.) "A parameter could not be serialized":
For a quick resolve: uncheck option "Excute business operations in CIL"  under Tools-> Options -> Development tab.












The reason is that you haven't been able to do a successful FULL CIL compile.
Run again and try to fix the error in CIL.

2.)"CIL generation: source array was not long enough...":

1. Stop the AOS.
2. Delete all of the source in the C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL directory.
3. Start the AOS.
4. Perform a full CIL generation.
5.(Only do if errors are still there and you have no error when compile X++, just comment the code notice in Compiler output with /*..*/, recompile CIL and delete comment tag)

3.) "CIL generation error : The given key was not present in the dictionary":

1. Check the CIL log file, generally located at "C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\Dynamics.Ax.Application.dll.log"
2. You will find the AOT object for which the CIL generator found the error.
3. Compile that object, fix the error, or delete (if needed) and then regenerate the IL.
4. (Only do if errors are still there : Stop AOS > Delete the .auc file from users\\Appdata  folder > Restart AOS)

4.) DB synchronize error: "Field mismatch in union query. Field ... is not compatible with field ..."

Check your EDT concern to that field ( in query, table, view). They have different size.
So you just change the size to be the same.
Or check someone changed size of standard EDT. It's the reason cause this error

5.) "Duplicate type with name 'Dynamics.Ax.application.' in assembly 'Dynamics.Ax.application "

1. Stop the ax service.

2. Truncate the SysXPPAssembly in db model
3. Delete all the files in below directory in server where AOS hosted:

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL

4. Start the service

5. Compile full CIL

Tuesday, January 3, 2017

Email drill-down link not working

Copy the AxHLink.Exe...

Wednesday, December 28, 2016

Ax 2012 deki Word-Add in çilesine karşı 2009 Document Handling ile devam



https://www.youtube.com/watch?v=NVSxc2jg2iY


Tuesday, November 15, 2016

Document Attachment through X++

static void hb_attach(Args _args)

{

DocuRef docuRef;

DocuActionArchive archive;

CustTable _custtable;

str _name;

;

 

_name=@"c:\\hb.docx";

select RecId from _custtable where _custtable.AccountNum =="M0001";

 

if (_custtable!=null)

{

ttsBegin;

docuRef.clear();

docuRef.RefRecId = _custtable.RecId;

docuRef.RefTableId = tableNum("custtable");

docuRef.RefCompanyId = curext();

docuRef.Name = _name;

docuRef.TypeId = 'File';

docuRef.insert();

archive = new DocuActionArchive();

archive.add(docuRef, _name);

ttsCommit;

}

}