Showing posts with label Batch Job. Show all posts
Showing posts with label Batch Job. Show all posts

Multi-thread Imports in Dynamics 365 for Finance & Operations

  

Multi-thread Imports in Dynamics 365 for Finance & Operations


There are a few perplexities on how to multi-thread your imports in Dynamics 365 for Finance and Operations. The primary thing to know is that Microsoft prevents you from multi-threading a few entities, which may be a great thing. Usually great since in Flow AX 2012 you'll multi-thread any substance and fundamentally, in case the arrange of the records getting imported is critical, at that point, multi-threading isn’t a great alternative since in case they go out of grouping due to records getting imported in parallel you'll degenerate your data.

The moment the thing to know is how to set up multi-threading in Dynamics 365FO. To do this you essentially go to Workspaces > Information Administration > Tap the System Parameters tile > Substance Settings tab > Press Arrange Substance Execution Parameters.



Within the entity execution parameters, you're defining how numerous strings ought to be utilized after you purport a substance in the group. You wish to get it merely can set up a substance at different times in this frame as seen below.





You're defining three things within the form:

Entity – What substance are you setting multi-threading up for.

Import threshold– The threshold tells the framework how numerous records got to be imported to utilize this line.

Import record count – How numerous strings ought to be utilized; aka how numerous assignments are created. Example Let’s walk through an illustration of bringing in the “Customer Definition” substance with 1360 records.

Next Actions

Create Import project, add the entity you added earlier in the execution parameters form, and import in the batch mode.


To verify multi threading go to the Batch job screen, find your job and check in the view task screen, you will find multiple threads of your task.


D365FO Batch Job retries

 

Enable automatic retries on batch jobs


In the April/May released, Microsoft introduces the feature to retry the batch job, In the past, if the Finance and Operations apps experience any kind of loss of connection to Microsoft SQL Server, then all batch jobs that are running fail, and the reason is, on Azure if the connection is lost then the recovery is almost impossible.

So, Microsoft introduces an Interface class that will batch to reset itself in case of connection loss or failure.

How you can implement it in your code?

Here is an example if you are using the "RunBaseBatch" class in your batch Job.

class TestBatchJob extends RunBaseBatch implements BatchRetryable

{

    [Wrappable(true), Replaceable(true)] // Change to meet your customizability requirements

    public boolean isRetryable() // Use final if you want to prevent overriding

    {

        return true; 

    }

}

 Here is an example if you are using the "SysOperationServiceController" class in your batch Job.

class TestBatchJob extends SysOperationServiceController implements BatchRetryable

{

    [Wrappable(true), Replaceable(true)] // Change to meet your customizability requirements

    public boolean isRetryable() // Use final if you want to prevent overriding

    {

        return true;

    }

}


Important

If you designing a multithreading job and adding the runtime task, then you should implement this interface on both the main controller and the task controller.


If you want to disable the retry of the batch job then add your class in the 

Batch class configuration overrides 


Overrides setup


Release Product Using X++

 


Release Product Using X++

You can use the below code to release the product to any legal entity using X++ or a custom batch job.

Sample Code

static void ReleaseProducts(Args _args)

{

EcoResProduct ecoResProduct;

;

select firstOnly ecoResProduct where EcoResProduct.DisplayProductNumber == "7042"; //Audio system

EcoResProductReleaseManagerBase::releaseProduct(ecoResProduct.RecId,

CompanyInfo::findDataArea('USMF').RecId);

}


How to disable/hide report/Batch Job parameter on Dialogue

 

How to disable/hide report/Batch Job parameter on Dialogue




To hide the parameter from report/job dialogue, use the below annotation on the param method of the Report/Job data contract class.


[SysOperationControlVisibilityAttribute(false)].

Sample

Parameter will visible:

    [DataMemberAttribute,

    SysOperationLabelAttribute(literalStr("Task Size")),

    SysOperationGroupMemberAttribute("ParameterGroup"),

    SysOperationDisplayOrderAttribute("3")]

    public AD_BatchTaskSize parmBatchTaskSize(AD_BatchTaskSize _batchTaskSize = batchTaskSize)

    {

        batchTaskSize = _batchTaskSize;

        return batchTaskSize;

    }

Parameter will not visible:

    [DataMemberAttribute,

    SysOperationControlVisibilityAttribute(false)]

    public RecId parmFromRecId(RecId _fromRecId = fromRecId)

    {

        fromRecId = _fromRecId;

        return fromRecId;

    }

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...