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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 545 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 408

#3
Adis Profile Picture

Adis 267 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans