web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Import sales line with finance dimension values though data entity

(0) ShareShare
ReportReport
Posted on by 45

I created one custom entity for importing data and  write a custom method for create default dimension for corresponding imported finance dimension values.Here my problem is that where i can call this method.

private int generateDefaultDimension()
    {
        DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();
        DimensionDefault                    result;
        int                                 i;
        DimensionAttribute                  dimensionAttribute;
        DimensionAttributeValue             dimensionAttributeValue;
        SalesTable                          salesTable;
        SalesLine                           salesLine;
        str                                 dimValue;
        IMPDSalesLineStaging                salesLineStaging;
        container                           conDim;

        select firstonly salesLineStaging
            where salesLineStaging.SalesId == this.SalesId &&
            salesLineStaging.ItemId == this.ItemId;

        container   conAttr = ["cashFlow", "department", "Doctor_Technician","Family","Section","Type","Unit","Worker"];
        container   conValue = [  salesLineStaging.CashFlow,salesLineStaging.Department,salesLineStaging.Doctor_Technician,salesLineStaging.Family,salesLineStaging.Section,salesLineStaging.Type,salesLineStaging.Unit,salesLineStaging.Worker];
        //container   conValue = [this.CashFlow,this.Department,this.Doctor_Technician,this.Family,this.Section,this.Type,this.Unit,this.Worker];



        for (i = 1; i <= conLen(conAttr); i  )
        {
            dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
            if (dimensionAttribute.RecId == 0)
            {
                continue;
            }
            dimValue = conPeek(conValue,i);
            if (dimValue != "")
            {
                dimensionAttributeValue = dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                valueSetStorage.addItem(dimensionAttributeValue);
            }
        }

        result = valueSetStorage.save();
        


        

        return result;



    }

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, I have done same requirement few years ago and called the method in mapEntityToDatasource method of data entity.

    Please check code I shared in below thread and call your method. Let us know if any issues.

    community.dynamics.com/.../modified-field-in-entity-not-working

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 659 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 533 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 289 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans