Skip to main content

Notifications

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;



    }

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Import sales line with finance dimension values though data entity

    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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans