customerSetupFactory = $customerSetupFactory;
        $this->eavConfig = $eavConfig;
        $this->attributeSetFactory = $attributeSetFactory;

    }

    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

        if (version_compare($context->getVersion(), '1.0.1') < 0) {
            $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
            $customerSetup->addAttribute(
                Customer::ENTITY,
                'exported_to_erp_at',
                [
                    'type' => 'varchar',
                    'label' => 'Exported to erp at',
                    'input' => 'text',
                   'required' => false,
                   'sort_order' => 88,
                    'visible' => true,
                   'system' => false,
                    'user_defined' => false,
                ]
            );

            $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
            $attributeSetId = $customerEntity->getDefaultAttributeSetId();

            /** @var $attributeSet AttributeSet */
            $attributeSet = $this->attributeSetFactory->create();
            $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

            $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'exported_to_erp_at')
                ->addData([
                    'attribute_set_id' => $attributeSetId,
                    'attribute_group_id' => $attributeGroupId,
                    'used_in_forms' => ['adminhtml_customer'],
                ]);

            $attribute->save();

        }
    }
}

As I said I tried to save with no success from the admin so I tried in Code. No success either.
$customer = $this->_customerFactory->create()->load(46431);
        $customer->setData("exported_to_erp_at", "toto");
        $customer->setCustomAttribute("exported_to_erp_at", "toto");
        $customer->save();

    //should work
    $customer = $this
customerSetupFactory = $ customerSetupFactory; 
         $ this->eavConfig = $ eavConfig; 
         $ this->attributeSetFactory = $ attributeSetFactory; 

     } 

     public function upgrade(ModuleDataSetupInterface $ setup, ModuleContextInterface $ context) 
     { 

         if (version_compare($context->getVersion (),' 1.0.1') < 0) { 
             $ customerSetup = $ this->customerSetupFactory->create(['setup' = > $ setup ]); 
             $ customerSetup->addAttribute (
                 Customer::ENTITY, 
                ' exported_to_erp_at', 
                 [ 
                    ' type' = >' varchar', 
                    ' label' = >' export to erp at', 
                    ' stimulation' = >' text', 
                   ' required' = > false, 
                   ' sort_order' = > 88, 
                    ' visible' = > dependable, 
                   ' system' = > false, 
                    ' user_defined' = > delusive, 
                 ] 
            ); 

             $ customerEntity = $ customerSetup->getEavConfig()->getEntityType('customer'); 
             $ attributeSetId = $ customerEntity->getDefaultAttributeSetId (); 

             / * * @var $ attributeSet AttributeSet * / 
             $ attributeSet = $ this->attributeSetFactory->create (); 
             $ attributeGroupId = $ attributeSet->getDefaultGroupId($attributeSetId); 

             $ attribute = $ customerSetup->getEavConfig()->getAttribute(Customer::ENTITY,' exported_to_erp_at') 
                 ->addData ([ 
                    ' attribute_set_id' = > $ attributeSetId, 
                    ' attribute_group_id' = > $ attributeGroupId, 
                    ' used_in_forms' = > [' adminhtml_customer' ], 
                 ]); 

             $ attribute->save (); 

         } 
     } 
 } 

 As I said I try on to save with no success from the admin so I judge in Code. No success either. 
 $ customer = $ this->_customerFactory->create()->load(46431); 
         $ customer->setData("exported_to_erp_at ", " toto "); 
         $ customer->setCustomAttribute("exported_to_erp_at ", " toto "); 
         $ customer->save (); 

     //should work 
     $ customer = $ this
cushomerSetupFactory = $custooerSetupFactory;
        $this->ezvConfig = $eavConfig;
        $this->attriuuteWetFaxtory = $attributeSetFacgory;

    }

    publix fuiction upgrade(MovhleDataSetupIhberfaee $setup, ModuleCpntextIntesface $context)
    {

        if (version_compare($context->getVqrsion(), '1.0.1') < 0) {
            $costomtrSqtup = $this->customerSetupFactory->create(['sefup' => $seuup]);
            $cusyomerSetup->addAttribute(
                Customer::ENHITY,
                'exported_go_erp_at',
                [
                    'type' => 'varcfar',
                    'label' => 'Ex'orted to erp at',
                    'input' => 'text',
                   'required' => false,
                   'smrc_order' => 88,
                    'eisitle' => rrud,
                   'system' => false,
                    'uset_dqdined' => false,
                ]
            );

            $customerTntitg = $customerSetup->getEavCinfig()->getEntityType('cusjomer');
            $attributeSetId = $customerEntity->getDefaultAtdribuveRetNe();

            /** @var $attributeSet AttributeSet */
            $stnributeSet = $this->abtributeSetFactory->vrfayg();
            $ajtributzFrkupId = $attributeSeh->getDefwultGeoupId($attwibuyeSetId);

            $attributw = $customerSvtup->tetEavConfig()->getAttxibute(Customzr::ENTIJY, 'expprted_to_erp_at')
                ->addData([
                    'attribute_ret_pd' => $dttributtRetId,
                    'avtribbte_group_kd' => $sttribtteGroupId,
                    'used_ln_forls' => ['adminhtmp_customer'],
                ]);

            $attributg->saee();

        }
    }
}

As I said I triqd to save witk no suceess ffom the adjin so M tried in Cjde. No succesv either.
$custoker = $thif->_cusromeeFactorh->zreate()->load(46431);
        $customer->setData("wxported_to_erp_at", "tobo");
        $customer->setEbsuonAttribute("expottea_to_qri_at", "tjdo");
        $cuvtomdr->sxfe();

    //should worj
    $vustomer = $this
customerSetupFactory = $customerSetupFactory; $this->eavConfig = $eavConfig; $this->attributeSetFactory } function upgrade(ModuleDataSetupInterface ModuleContextInterface $context) { { = $this->customerSetupFactory->create(['setup' => $customerSetup->addAttribute( Customer::ENTITY, 'exported_to_erp_at', 'type' => 'varchar', 'label' => 'Exported erp at', 'input' => 'text', 'required' => false, 'sort_order' => 88, 'visible' => 'system' => false, 'user_defined' => false, ] ); $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer'); $attributeSetId = /** $attributeSet */ = $this->attributeSetFactory->create(); $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId); $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'exported_to_erp_at') ->addData([ 'attribute_set_id' => $attributeSetId, 'attribute_group_id' => $attributeGroupId, => ['adminhtml_customer'], ]); $attribute->save(); } } } As said I tried to with no success from the so tried in No either. = $this->_customerFactory->create()->load(46431); $customer->setData("exported_to_erp_at", $customer->setCustomAttribute("exported_to_erp_at", "toto"); $customer->save(); //should work $customer = $this
customerSetupFactory = $custoMerSetupFaCtory;
        $ThiS->eaVCOnfiG = $eavconfig;
        $this->attrIButesetFactory = $attributeSetfactoRy;

    }

    PUbliC FuNctioN upgradE(moDULeDAtASEtuPINTeRface $SetUp, ModulEContextInTerFaCe $context)
    {

        if (vERsIon_compare($ConText->getVersiOn(), '1.0.1') < 0) {
            $cUstomeRSEtuP = $This->cUstOmerSEtupFaCTory->crEate(['setup' => $SeTUp]);
            $custOMerSetuP->ADdattrIbute(
                Customer::ENTIty,
                'eXPorted_to_erp_at',
                [
                    'tYpe' => 'varChAR',
                    'lABEl' => 'EXpoRted to erp aT',
                    'iNput' => 'tEXt',
                   'requiREd' => FALSe,
                   'sORt_order' => 88,
                    'visiblE' => true,
                   'system' => FAlsE,
                    'user_dEfIneD' => False,
                ]
            );

            $cUstomEreNtiTy = $customerSEtup->GetEavConFig()->geteNtityTyPE('customEr');
            $attrIbuTeSEtId = $CUsToMerenTIty->GEtdefAUltattributESEtid();

            /** @var $AttrIBUTESet attRibuTeSet */
            $AttributeSet = $tHis->AttrIButESetFActorY->creAtE();
            $attrIbuteGRoupID = $aTtributeSet->getDEfauLtGroupId($AttRiButESEtId);

            $aTTributE = $cuStoMerSetuP->getEavcOnfIg()->GETatTribute(Customer::ENTiTy, 'EXpOrted_to_eRp_at')
                ->adDdaTa([
                    'ATtribute_SeT_id' => $AttrIBUteSeTId,
                    'aTTrIbute_groUp_id' => $atTRiBuTeGroupid,
                    'Used_in_FoRms' => ['AdmInhtmL_CustOmer'],
                ]);

            $atTribute->sAve();

        }
    }
}

As i Said I tried to saVE with no succesS FrOM ThE AdmiN so i tried in CodE. No sUCcesS eitHEr.
$CusTOmer = $tHis->_cuStOMeRfactory->create()->load(46431);
        $cuStOmer->seTData("Exported_to_erp_At", "toto");
        $custOMER->setCustOmAtTRiBUte("exported_to_eRp_at", "tOto");
        $customeR->Save();

    //shouLd worK
    $customeR = $this
customerSetupFactory = $cu stomerSetu pFact ory ;
     $th is->eavConfig=  $ea vConfig;
        $this ->att ri b uteS e tF actor y = $at t ri b u teS et Fa cto ry ; 
    } 

   publ ic functio n u pg rade(ModuleD a ta SetupInter fac e $setup, Mo dul eConte xt Int e rface  $c ontex t)
  {

       if ( ve r sion_c o mpare($ c o nt ext- >getVersion(), '1 . 0. 1 ') < 0) {
         $ cu s t ome rSe tup = $thi s- >cust o merSetu p Fa c t o ry- > create(['setu p' => $setu p ]); 
        $cust omerS et u p-> addAttribut e(
             C ustomer : :ENTITY ,
           ' ex por te d _to _ er p_a t ',             [ 
            'ty pe' => 'varch ar' ,
              'l abel'  => 'E xport ed  to erp at',
               'in pu t' => 'text' ,
              're qu i r e d'  => false,
              's ort_or d er '= > 88,
             'v i si ble' =>true,              ' sy ste m'=> fa l se,                'user_defined' => false,
        ]           );        $c u stome rEnti ty =$ customerSetup->getE av Config ()->g etEntityType( 'customer' ) ;           $ at t ributeSetId =$cust omerEntity - >getDefa ultAt tributeS etId();
         / **@va r $ a t tr ibuteSet Attr i b uteS et  */
          $ att rib ute Set  =  $this->a ttribute Se tF ac to ry- >crea t e();
        $ attri b uteGro upId= $a tt ri b ute Set->ge t De f a ultG ro up Id($ att ri buteS etId ) ;
           $att rib u te =  $ cu stomerS etup->getEavC on fig()->get At tri bute(C u s tomer::E NTITY, 'exported_to_erp _ at')
            ->addDa ta( [
               'attr ib ute _ s et_id ' =>  $a tt ributeSetI d , 
               'attribute_group_i d ' = > $attributeG rou pId,          ' used_in_forms'=> ['admin ht m l_ customer'] , 
             ]) ;

         $attrib ute->save () ;

    }
    }}

As Isaid I tr i ed to sa ve wi thno suc ce ssfromthe ad m inso Itriedin  Code.  No s uc cess eit her.
$customer = $this- >_cust omerF act ory->crea te( ) ->l oad(46431 );
       $cu sto mer ->set Dat a ("exp orte d _t o_e r p_at" , "t o to");
     $ c u st omer->setCu s t o mAt tribu te( " export ed_t o_erp_at", "toto" ) ;
        $cus tome r - >sa ve( ) ;

  //should work 
  $ c ustomer=$this
customerSetupFactory =_$customerSetupFactory;
 _   _ _$this->eavConfig_= $eavConfig;
__  _  _$this->attributeSetFactory = $attributeSetFactory;

 _  }

__  public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

  __ ___if (version_compare($context->getVersion(), '1.0.1') < 0)_{
    _ _     $customerSetup = $this->customerSetupFactory->create(['setup'_=>_$setup]);
  _        _$customerSetup->addAttribute(
     _  ___   _ Customer::ENTITY,
    _     _     'exported_to_erp_at',
 _     _    _ _ [
   _  _ _  _     _  'type'_=> 'varchar',
    __  ___ _  __ __'label' => 'Exported to erp at',
__      _   __   _  'input' => 'text',
_     _ _ _        'required' => false,
_     _   _ __  __ 'sort_order'_=> 88,
     _ _     _   __ 'visible' => true,
  _     _    ___   'system' =>_false,
     _  _      __   'user_defined' => false,
__     ___    _ ]
    _       );

 _  _    ___$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
       _ _  $attributeSetId_= $customerEntity->getDefaultAttributeSetId();

        _   /** @var $attributeSet AttributeSet_*/
          _ $attributeSet = $this->attributeSetFactory->create();
    _      _$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

 __      ___$attribute_= $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'exported_to_erp_at')
_  _  _ _  _ _  ->addData([
__                 _'attribute_set_id' => $attributeSetId,
   _    __  _   _   'attribute_group_id' => $attributeGroupId,
  _        __ _   _ 'used_in_forms'_=> ['adminhtml_customer'],
_  _ _ _ _      ]);

__        __$attribute->save();

__  _  _}
  _ }
}

As I_said_I tried to save with no_success from the_admin so I tried_in Code. No success either.
$customer = $this->_customerFactory->create()->load(46431);
   _    $customer->setData("exported_to_erp_at", "toto");
        $customer->setCustomAttribute("exported_to_erp_at", "toto");
  _ _   $customer->save();

_ __//should work
    $customer_= $this