Checkbox "Copy billing address to shipping address" not ticked when creating a record through API

This checkbox is always ticked by default when creating a new account record manually in SugarCRM, but never when creating a record through the REST API.

I've searched around and experimented and it seems like it is not even a Sugar field, even though its "field name" appears to be simply "copy".

Sending this in the record creation request does not tick it:

"copy": "true"

Is there a way to tick this checkbox through API only?

Or is the only way really to create an entire customisation with JavaScript code that would tick this checkbox based on a handful of conditions?

Parents Reply Children
  • Hi Artis,

    You are correct, it appears as of latest version it does not show as checked even when the fields match. I had tested that in some previous version before, and that was the case, and it does still appear their is logic to check that the defined fields in the metadata mapping are the same, but its only triggering once, and I believe before the data is loaded. This might be a Bug, so I will run it through our process to see if this is intended functionality now.

    You can review the code for that field in your instance here: clients/base/fields/copy/copy.js

    You might notice a TODO tag, stating the field should be stored in the DB. 

    I tried making a custom field copy_c via studio, and updating the RecordView metadata to use that field instead, however the Field JS Controller doesn't handle getting the value from the model correctly, and there isn't any logic to push the value to the model during DOM Change. Your best bet would be to extend the field, to alter the logic to handle getting the value from the model and setting it when its changed (and using a custom field to store the value, which then allows you to check it from the API). Just know that even with this route, you still need to manually make the values the same via API, unless you also add in a LogicHook on the backend.

    Let me know if you have any questions.