Sys Operation framework – Adding Class to Batch Task/making Journalized

Problem statement:

We have batchable  class that needs to be added to Batch Task form (System Administration> Batch>View Task) so we can plan batch job executions like if any dependencies or sequencing needs to be managed between the batch classes.

For such tasks class should be Journalized.

We know that if we are using old RunBaseBatch framework we can make the class Journalized by overriding the method canGoBatchJournal() and let it return true.

But if we have implemented the Batch using new SysOperation framework then we need to following things.

We need to have Controller class, as Batch task will be scheduled based on it.
Controller class needs to be decorated using attribute “[SysOperationJournaledParametersAttribute(true)]”
Main and new method should have important information provided as heighted below. These needed for initializing the parameters in Batch Task.

6-3-2016 9-55-47 PM

6-3-2016 9-56-33 PM

6-3-2016 9-57-03 PM

Thanks you

Happy Daxing 🙂

Advertisements

Consuming Pending Vendor invoice service from C#

This blog refers to consuming or creating Pending vendor invoice record in dynamics ax 2012 R3 using out of box service “VendVendInvoiceService”. The focus of this blog is .net C# side. In this example I took the complex case of creating Vendor invoice that linked to multiple PURCHASE ORDERS in received status.

This ADDHeader method insert record in VendInvoiceInfoTable, for this example I just filled the required ones.

header

This ADDLine method insert a line in VendInvoiceInfoLine table. this is helper method will be called from main executing point.

line

This is the main executing method, In this method I did initialization of required objects, make find call of two purchase order records using Purchase order service (You could do this by any way, hard coded or service call or through .net proxies). Here I am also making the call of AddHeader method to create the header record

methosstart

Further on the same method, call AddLine to create Line record, Also specify the QTY that how much I want to invoice from the receiving, I did the same for both the purchase orders.

beforetry

After composing complete message, making Create call to service

try

Thanks
Amir (Happy Daxing)

 

Settlements (Technical Utility methods)

Piece of code that checks if the invoice is already marked with some payment or not

 protected boolean checkIfAlreadyMark(CustVendTransOpen _custVendTransOpen)  
 {  
   specTransManager specTransManager = specTransManager::construct(_custVendTransOpen);  
   return specTransManager.existForOtherSpec(_custVendTransOpen.company(), _custVendTransOpen.TableId, _custVendTransOpen.RecId);  
 }  

Piece of code that settles the invoice with the payment

 protected void markSettlement(CustVendTransOpen _custVendTransOpen)  
 {  
   CustVendOpenTransManager manager = CustVendOpenTransManager::construct(ledgerJournalTrans);  
   manager.updateTransMarked(_custVendTransOpen, true);  
 }  

Opening Balance import through DIEF (Data Import Export Framework

Hi Guys and Happy Independence day to all my country mates and Happy Birth day to PAKISTAN

9

Okie, This exercise is about importing Opening Balance through DIEF (Data Import Export Framework, I am using Dynamics AX R3 CU8.

1 Create “Processing Group” – “Opening Balance”

7

2 Click Entities and select Entity as “Opening Balance”
3 Select Source data format as “Excel”
We need to create source data format record as this6

4 Click Generate Source file for generating the template, We can select all the needed fields here.

8

5 Click Modify Source Mapping,
Ops here I got the error

Error Message: Assembly containing type Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntityProxy is not referenced.

Object ‘CLRObject’ could not be created

There can be multiple reason for this issue but I solved it through these steps.

Solution: Above mention error come because you are trying to set parameter without installing its component (Service, Server and Client). Just install those component from setup file and restart the AOS service. Now this error should not bother you this time. 🙂

After restarting the AX, I have open the parameter form, specified the correct shared working directory and validate the settings.

5

OK, NOW BACK TO MAIN TOPIC.

5 Click again on “Modify Source Mapping,”

As we need Journal Number to be Auto generated, I modify it by marking JournalNumber auto generated, and I also added the JournalName field in Query Criteria such that all the lines (with the same JournalName value) will be assigned the same JournalNumber

4

After this select the excel file with data in the ENTITIES form and click preview to viewing the data.

3

In the last for moving the data to staging table, click “Get staging data” then for copying the data to target, click on Copy data to target.

2

and here we have the end result

1

BIG THANK YOU AND HAPPY DAXING 🙂

%d bloggers like this: