Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id : DwV0YMHm9T+2dE75T7RX8u
Finance | Project Operations, Human Resources, ...
Answered

Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

Like (0) ShareShare
ReportReport
Posted on 5 Feb 2022 23:00:22 by

When i want to insert new record in LogisticsPostalAddress via job , i get this error 

Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

Anyone with some solution? it is might worth mentioning that i am entering, address, location, countryPostalCode but still this error

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on 06 Feb 2022 at 14:21:35
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    What value are you assigning to CountryRegionId? You can check if this value exists in Country/region under Address setup (Navigation : Organization administration > Setup > Addresses).

  • Community Member Profile Picture
    on 06 Feb 2022 at 13:55:00
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    With code above I am getting error

    Check country/region

  • Community Member Profile Picture
    on 06 Feb 2022 at 10:28:14
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    Thank you, for this

    I will do this

    Have a great day

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on 06 Feb 2022 at 09:47:03
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    Hi,

    There are a few issues here. Looking at your code, I believe you are trying to add delivery address to the sales agreement.

    1. LogisticsPostalAddress has an unique key based on Location and ValidFrom fields. Additionally Location is an FK from LogisticsLocation table. So, while creating an address, you will need to create a new location record.

    2. For creating addresses, the individual fields need to be populated - Street, City, Zip, State etc. The field Address ,which you are trying to populate now, is formatted from these values. If these are not mentioned, all you will be able to see in the Address field is the country name.

    3. You will need to perform insert of LogisticsPostalAddress first, so that you can assign the value to AgreementHeaderDefault.DeliveryPostalAddress field. I also didn't see any code for inserting agreementHeaderDefault record in your code.

    You can use this code for inserting a postalAddress record.

    public LogisticsPostalAddressRecId createPostalAddress(LogisticsAddressStreet           _street,
                                                           LogisticsAddressCity             _city,
                                                           LogisticsAddressZipCodeId        _zipCode,
                                                           LogisticsAddressStateId          _state,
                                                           LogisticsAddressCountryRegionId  _country,
                                                           Description                      _addressName)
    {           
    LogisticsPostalAddress logisticsPostalAddress;
    LogisticsPostalAddressEntity postalAddressEntity;
    LogisticsPostalAddressView addressView;
    DirPartyPostalAddressView partyAddressView;
    
    logisticsPostalAddress.Street           = _street;
    logisticsPostalAddress.City             = _city;
    logisticsPostalAddress.ZipCode          = _zipCode;
    logisticsPostalAddress.State            = _state;
    logisticsPostalAddress.CountryRegionId  = _country;
    
    partyAddressView.initFromPostalAddress(logisticsPostalAddress);
    partyAddressView.LocationName = _addressName;
    
    postalAddressEntity = LogisticsPostalAddressEntity::construct();
    
    addressView.initFromPartyPostalAddressView(partyAddressView);
    logisticsPostalAddress = postalAddressEntity.createPostalAddress(addressView);
    
    return logisticsPostalAddress.RecId;
    
    }

  • Community Member Profile Picture
    on 06 Feb 2022 at 00:28:03
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    i am getting this error when entering from code, maybe the problem is that I am inserting sales agreement header , and logistics address in the same time?

    Here is my code        

          info("start");

                  ttsBegin;

                  do

                   {

                        row++;

     

                        if(externalItemId!=redFlag)

                       {

     

     

                        i++;

     

     

                        //READING FROM EXCEL

                        salesAgreementId        = cells.item(row, 1).value().bStr();

                        custAccount             = cells.item(row, 2).value().bstr();

                        custRequisitionNumber   = cells.item(row, 3).value().bStr();

                        effectiveDate           = cells.item(row, 4).value().date();

                        expirationDate          = cells.item(row, 5).value().date();

                        agreementState          = AgreementState::Effective;

                        documentTitle           = cells.item(row, 7).value().bStr();

                        agreementClassification = cells.item(row, 8).value().bstr();

                        deliveryName            = cells.item(row, 9).value().bStr();

                        deliveryAddress         = cells.item(row, 10).value().bStr();

                        gate                    = cells.item(row, 11).value().bStr();

                        externalItemId          = cells.item(row, 12).value().bStr();

                        currencyCode            = cells.item(row, 14).value().bstr();

     

     

     

                        //ASSIGNING VALUES

                        salesAgreementHeader.SalesNumberSequence                 =   salesAgreementId;

                        salesAgreementHeader.CustAccount                         =   custAccount;

                        salesAgreementHeaderDefault.CustomerRequisitionNumber    =   custRequisitionNumber;

                        salesAgreementHeader.DefaultAgreementLineEffectiveDate   =   effectiveDate;

                        salesAgreementHeader.DefaultAgreementLineExpirationDate  =   expirationDate;

                        salesAgreementHeader.AgreementState                      =   AgreementState::Effective;

                        salesAgreementHeader.DocumentTitle                       =   documentTitle;

                        agreementHeaderDeafult.DeliveryName                      =   deliveryName;

                        logisticsPostalAddress.Address                           =   deliveryAddress;

                        amvSalesAgreement.LogisticsGate                          =   gate;

                        amvSalesAgreement.ExternalItemId                         =   externalItemId;

                        agreementClassificationTable.Name                        =   agreementClassification;

                        salesAgreementHeader.Currency                            =   currencyCode;

     

                       

                        logisticsPostalAddress.CountryRegionId="test";

                        logisticsPostalAddress.Location=123;

                        LogisticsPostalAddress.ValidFrom=myDateTime;

     

     

                        //INSERT

                        //SalesAgreementHeader

                        salesAgreementHeader.insert();

     

                        //SalesAgreementHeaderDefault

                        salesAgreementHeaderDefault.SalesAgreementHeader = salesAgreementHeader.RecId;

                        if(SalesAgreementHeaderDefault.validateWrite())

                           {

                              salesAgreementHeaderDefault.insert();

                           }

     

                         //LogisticsPostalAddress

                        if(logisticsPostalAddress.validateWrite())

                           {

                             logisticsPostalAddress.insert();

                           }

     

                       }

                       else

                       {

                         redFlag='empty';

                       }

                      type = cells.item(row+1, 1).value().variantType();

                   }

                  while (type != COMVariantType::VT_EMPTY);

                  info(strFmt("%1",i));

                  workbooks.close();

                  application.quit();

                  ttsCommit;

     

     

            }

  • Gunjan Bhattachayya Profile Picture
    35,421 on 05 Feb 2022 at 23:31:35
    RE: Cannot create a record in Addresses (LogisticsPostalAddress). Insert not supported with the values specified for 'Effective:' and 'Expiration:'. New record overlaps with multiple existing records.

    Hi SIwannaS,

    Are you using code to insert new addresses or are you getting this error from the application? If the former is true, could you share you code here?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading started
Loading complete