Adding Acumatica Customer Contacts

341 views Asked by At

I am having problem adding customer contacts using web services, at first instance of integration my application successfully adds the contacts using web services. But when i re-integrate the same contact in the same customer it duplicates the previously integrated contacts instead of just updating them. I tried adding value to the ContactID field but it gives me the error of convert failed from string to int.

AR303000Content custSchema = context.AR303000GetSchema();
                        var commands = new Acumatica_LSOne_Integration.ARMODULE.Command[]
                        {
                            new Acumatica_LSOne_Integration.ARMODULE.Value 
                            {
                                Value = RecID.Replace("-"," ").Trim(), 
                                LinkedCommand = custSchema.CustomerSummary.CustomerID 
                            },

                            custSchema.Actions.NewContact
                        };
                        context.AR303000Submit(commands);

                        CR302000Content contSchema = context.CR302000GetSchema();
                        commands = new Acumatica_LSOne_Integration.ARMODULE.Command[]
                        {                                
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("CONTACTNAME")).Trim(), LinkedCommand = contSchema.DetailsSummary.LastName}, 
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("STREET")).Trim(), LinkedCommand = contSchema.DetailsAddress.AddressLine1},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("ADDRESS")).Trim(), LinkedCommand = contSchema.DetailsAddress.AddressLine2},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("CITY")).Trim(), LinkedCommand = contSchema.DetailsAddress.City},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("COUNTRY")).Trim(), LinkedCommand = contSchema.DetailsAddress.Country},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("ZIPCODE")).Trim(), LinkedCommand = contSchema.DetailsAddress.PostalCode},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("EMAIL")).Trim(), LinkedCommand = contSchema.DetailsContact.Email},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("PHONE")).Trim(), LinkedCommand = contSchema.DetailsContact.Phone1},
                            new Acumatica_LSOne_Integration.ARMODULE.Value {Value = reader1.GetString(reader1.GetOrdinal("CELLULARPHONE")).Trim(), LinkedCommand = contSchema.DetailsContact.Phone2},
                            contSchema.Actions.Save,
                        };
                        context.CR302000Submit(commands);
1

There are 1 answers

8
Sin On BEST ANSWER

Hope you are using Screen ID's AR303000 and CR302000,

  • After you add the command for action "Add Contact" in customer schema and submit
  • You may use the screen CR302000 and set the ContactID and submit first to load all information(if exists) to the schema
  • later you add commands for the update of required values and submit with save command.