c# - How to inactivate a Vendor from graph - Stack Overflow

I am trying to Inactivate a Vendor in acumatica using below code. But the status does not change to ina

I am trying to Inactivate a Vendor in acumatica using below code. But the status does not change to inactive.
Why ?

void deactivateVendor(string vendorName)
  {
      try
      {
          VendorMaint graph = PXGraph.CreateInstance<VendorMaint>();
          PXResultset<Vendor> vendors = PXSelect<Vendor,
              Where<Vendor.acctName, Equal<Required<Vendor.acctName>>>>
              .Select(graph, vendorName);

          if (vendors.Count == 0)
          {
              return;
          }

          foreach (Vendor vendor in vendors)
          {
              vendor.Status = VendorStatus.Inactive;
              graph.Caches[typeof(Vendor)].Update(vendor);
          }

          graph.Actions.PressSave();
      }
      catch 
      {
      }
  }

I am trying to Inactivate a Vendor in acumatica using below code. But the status does not change to inactive.
Why ?

void deactivateVendor(string vendorName)
  {
      try
      {
          VendorMaint graph = PXGraph.CreateInstance<VendorMaint>();
          PXResultset<Vendor> vendors = PXSelect<Vendor,
              Where<Vendor.acctName, Equal<Required<Vendor.acctName>>>>
              .Select(graph, vendorName);

          if (vendors.Count == 0)
          {
              return;
          }

          foreach (Vendor vendor in vendors)
          {
              vendor.Status = VendorStatus.Inactive;
              graph.Caches[typeof(Vendor)].Update(vendor);
          }

          graph.Actions.PressSave();
      }
      catch 
      {
      }
  }
Share Improve this question edited Mar 3 at 14:20 wohlstad 30.3k17 gold badges61 silver badges94 bronze badges asked Mar 3 at 11:57 TheCoderTheCoder 1573 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Vendor status is stored in VStatus field.

vendor.VStatus = VendorStatus.Inactive;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745096025a4610981.html

相关推荐

  • c# - How to inactivate a Vendor from graph - Stack Overflow

    I am trying to Inactivate a Vendor in acumatica using below code. But the status does not change to ina

    12小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信