0

您好,如何在我的流程中在代码后面添加一个具有默认联系人的新客户。

到目前为止,我有这个,但我需要创建一个联系对象以某种方式链接两者。

            PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();

            m.AcctCD = "Test1";
            m.AcctName = "Joe Bloggs";
            m.Type = "CU";

            Customers.Insert(m);

            Persist();
4

2 回答 2

2
        CustomerMaint graph = PXGraph.CreateInstance<CustomerMaint>();

        Customer cust = new Customer();
        cust.AcctName = "Company Name";
        cust = (Customer)graph.CurrentCustomer.Insert(cust);

        Address addr = (Address)graph.Addresses.Current;
        addr.AddressLine1 = "Address 1";
        addr.AddressLine2 = "Address 2";
        addr.City = "City";
        addr.State = "State";
        addr.PostalCode = "Zip";
        addr.CountryID = "Country";
        graph.Addresses.Update(addr);

        Contact contact = (Contact)graph.DefContact.Current;
        contact.ContactType = ContactTypesAttribute.BAccountProperty;
        contact.FirstName = "FirstName";
        contact.LastName = "Last Name";
        contact.EMail = "emaiL@email.com";
        contact.WebSite = "www.website.com";
        contact.Phone1 = "1234567890";
        contact.Fax = "1234567890";
        graph.DefContact.Update(contact);


        graph.Actions.PressSave();
于 2015-04-24T16:23:54.230 回答
1

我所做的这似乎效果很好。得到了客户维护图的实例。将新客户插入当前客户并编辑当前定义联系人。

            PX.Objects.AR.CustomerMaint graph = PXGraph.CreateInstance<PX.Objects.AR.CustomerMaint>();

            PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();

            m.AcctCD = "Test4";
            m.AcctName = "Jo Bloggs";
            m.Type = "CU";

            graph.CurrentCustomer.Insert(m);

            PX.Objects.CR.Contact c = graph.DefContact.Current;

            c.ContactType = "AP";
            c.FullName = "Joe Bloggs";
            c.EMail = "joe@Bloggs.com";

            graph.Actions.PressSave();
于 2015-04-15T00:45:46.037 回答