Get your Intercompany CustAccount

Ever wonder if there is an easy way to find out what customer account a sales company has at the production company?

This might not be an easy way, but it is one way to do it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
static void FO_MyCustAccount(Args _args)
{
    VendTable               vendTable;
    AifEndpointId           endpointId;
    AifEndpoint             toEndpoint,
                            meEndPoint;
    AifEndPointConstraint   endPointConstraint;
    ;
 
    // Intercompany Vendor = 3045.
    vendTable   = VendTable::find("3045");
 
    // Get Vendor endpointId.
    endpointId  = vendTable.interCompanyEndpointId();
 
    // Get the endpoint.
    toEndpoint  = AifEndPoint::find(endpointId);
 
    // Change to endPoint company.
    changecompany(toEndpoint.InterCompanyCompanyId)
    {
        // Get your endpoint in Parent company.
        meEndPoint = 
        AifEndpoint::findInterCompany(
        toEndpoint.dataAreaId);
        // Find customer constraint.
        endPointConstraint = 
        AifEndPointConstraint::find(
        meEndPoint.EndpointId,
        AifConstraintType::Customer);
    }
 
    // ConstraintId = Your customer account.
    info(endPointConstraint.ConstraintId);
}

Last 5 posts in Development

One thought on “Get your Intercompany CustAccount

Leave a Reply

Your email address will not be published. Required fields are marked *