0
votes

I was trying to add a new "Location" record through web service API and the record did get added into Acumatica, however, when I looked my record I saw that "Same as Main" checkbox is checked in both of "Location Contact" and "Location Address" sections, and of course, all of the contact and address information appeared to be same as Main record, instead of using what I have tried to add. The below is part of my code:

CR303010Content CR303010 = context.CR303010GetSchema(); context.CR303010Clear();

            List<Command> cmds = new List<Command>();

            //add header info
            cmds.Add(new Value { Value = "False", LinkedCommand = CR303010.GeneralInfoLocationContactSameAsMain.SameAsMain });
            cmds.Add(new Value { Value = "False", LinkedCommand = CR303010.GeneralInfoLocationAddressSameAsMain.SameAsMain });
            cmds.Add(new Value { Value = location.BusinessAccountID, LinkedCommand = CR303010.LocationSummary.BusinessAccount });
            cmds.Add(new Value { Value = location.ID, LinkedCommand = CR303010.LocationSummary.LocationID });
            cmds.Add(new Value { Value = location.Name, LinkedCommand = CR303010.LocationSummary.LocationName });

            cmds.Add(new Value { Value = location.GeneralContactInfo.Salutation, LinkedCommand = CR303010.GeneralInfoLocationContact.Attention });
            cmds.Add(new Value { Value = location.GeneralContactInfo.CompanyName, LinkedCommand = CR303010.GeneralInfoLocationContact.CompanyName });
            cmds.Add(new Value { Value = location.GeneralContactInfo.Phone1, LinkedCommand = CR303010.GeneralInfoLocationContact.Phone1 });
            cmds.Add(new Value { Value = location.GeneralContactInfo.Phone2, LinkedCommand = CR303010.GeneralInfoLocationContact.Phone2 });
            cmds.Add(new Value { Value = location.GeneralContactInfo.Fax, LinkedCommand = CR303010.GeneralInfoLocationContact.Fax });
            cmds.Add(new Value { Value = location.GeneralContactInfo.Email, LinkedCommand = CR303010.GeneralInfoLocationContact.Email });
            cmds.Add(new Value { Value = location.GeneralContactInfo.Web, LinkedCommand = CR303010.GeneralInfoLocationContact.Web });

            cmds.Add(new Value { Value = location.GeneralAddressInfo.Address1, LinkedCommand = CR303010.GeneralInfoLocationAddress.AddressLine1 });
            cmds.Add(new Value { Value = location.GeneralAddressInfo.Address2, LinkedCommand = CR303010.GeneralInfoLocationAddress.AddressLine2 });
            cmds.Add(new Value { Value = location.GeneralAddressInfo.City, LinkedCommand = CR303010.GeneralInfoLocationAddress.City });
            cmds.Add(new Value { Value = location.GeneralAddressInfo.State, LinkedCommand = CR303010.GeneralInfoLocationAddress.State });
            cmds.Add(new Value { Value = location.GeneralAddressInfo.Country, LinkedCommand = CR303010.GeneralInfoLocationAddress.Country });
            cmds.Add(new Value { Value = location.GeneralAddressInfo.PostalCode, LinkedCommand = CR303010.GeneralInfoLocationAddress.PostalCode });

            cmds.Add(new Value { Value = location.PriceClass, LinkedCommand = CR303010.GeneralInfoLocationSettings.PriceClass });
            cmds.Add(new Value { Value = location.TaxZone, LinkedCommand = CR303010.GeneralInfoLocationSettings.TaxZone });


            cmds.Add(CR303010.Actions.Save);

            CR303010Content[] CR303010content = context.CR303010Submit(cmds.ToArray());

Can somebody please help me see why that "cmds.Add(new Value { Value = "False", LinkedCommand = CR303010.GeneralInfoLocationContactSameAsMain.SameAsMain });" didn't work at all?

Thanks.

2

2 Answers

0
votes

I too had a similar issue in sales order screen while working with HOLD. I suspect, For the checkbox it AND's with the existing value.

But in your case, We can see the checkbox you mentioned is not ticked by default, so avoid that command and submit.

0
votes

I just found this was actually an invalid question - the code was actually working and it turned out there was a bug in our another piece of software that was calling the wrong web service.

I'm closing this question now.