acumatica - How to inset a customer location through graph -
hello banging head against wall trying find correct way insert customer location using graph. using px.objects.cr.customerlocationmaint graph. when insert or set current location null.
here code
private px.objects.cr.location updatecustomerlocation(px.objects.ar.customer cust, listingread currentlisting, listingcontactrelnlisting contact) { px.objects.ar.customerlocationmaint g = new px.objects.ar.customerlocationmaint(); g.clear(pxclearoption.clearall); g.businessaccount.current = cust; px.objects.cr.location loc = new px.objects.cr.location(); loc.baccountid = cust.baccountid; loc.locationcd = "rl" + contact.contact.id; loc.descr = currentlisting.property.system_search_key; loc.defcontactid = cust.defcontactid; loc.isactive = true; loc.loctype = "cu"; g.location.current = loc; loc = g.location.insert(loc); px.objects.cr.address addr = new px.objects.cr.address(); addr.baccountid = cust.baccountid; addr.addresstype = "bs"; addr.countryid = "nz"; addr.addressline1 = currentlisting.property.adr_street_number + " " + currentlisting.property.adr_street_name; addr.addressline2 = currentlisting.property.adr_suburb_or_town; addr.addressline3 = currentlisting.property.adr_state_or_region; addr = g.address.insert(addr); loc.defaddressid = addr.addressid; g.location.update(loc); g.actions.presssave(); return loc; }
Comments
Post a Comment