Saturday, 11 July 2015

AX2012 R3 CU8 : X++ code to get resource requirements for production routes

Hi Friends,
The below X++ code, can be used to get the resource type and the resource ID defined on the production routes for a production order. Thanks to the methods available on ProdRoute table out of the box which makes this easy.

Below is the job simulating the code:

















To quickly reuse the code here it is:

static void Job45(Args _args)
{
    ProdRoute                       prodRoute;
    RecId                           recId;
    WrkCtrId                        wrkCtrGrpId;
    ProdId                          prodId = "W000170";
    WrkCtrActivityRequirementType   relationShipType;
    WrkCtrActivityRequirement       wrkCtrActivityRequirement;

    while select prodRoute
        where prodRoute.ProdId == prodId
    {
        recId = prodRoute.activityRequirementSet().RecId;

        select WrkCtrActivityRequirement
            where WrkCtrActivityRequirement.ActivityRequirementSet == recid;
        wrkCtrGrpId =  WrkCtrActivityRequirement.requirementEdit();
        relationShipType = WrkCtrActivityRequirement.RelationshipType;
       
        info(strFmt("%1, %2",relationShipType,wrkCtrGrpId));
    }
}

Have a great day.

3 comments:

  1. hi

    how to update resource or wrkctrgrpid for proudction order

    ReplyDelete
  2. Great post!

    Useful information worthy of thanks ,


    http://ixgram.com

    ReplyDelete
  3. Nice post...I look forward to reading more, and getting a more active part in the talks here, whilst picking up some knowledge as well..

    Pass Box manufacturers

    ReplyDelete