Setting Quote Version Custom Address through API

lock
push_pin
done
Beantwortet
1

Hi community.

I'm trying to set custom delivery address in SuperOffice using scripts, and I can't get it to work 100%.

It seems like there is a bug, such that this cannot be set using crmscript, so I'm trying to do it using the Agent API.

For some reason only Address1 and Address2 can be set, but not Zipcode and City, and I can't figure out why.

Look at the following two code-snippets. The first one, is the one I set using contactAgent/SaveQuoteVersionAddressAsync, and the second is from the network-tab using normal Quote in SuperOffice directly. What am I doing wrong?

Object I send with the contactAgent/SaveQuoteVersionAddressAsync request:

{
    "quoteVersionId": 52061,
    "address": {
        "tableRight": null,
        "fieldProperties": {},
        "wgs84Latitude": 0,
        "wgs84Longitude": 0,
        "localizedAddress": [
            [
                {
                    "tableRight": null,
                    "fieldProperties": {},
                    "name": "Address1",
                    "value": "Adresse 1",
                    "tooltip": "",
                    "label": "SR_AL_ADDRESS1",
                    "valueLength": 80,
                    "addressType": "PersonPrivateAddress"
                }
            ],
            [
                {
                    "tableRight": null,
                    "fieldProperties": {},
                    "name": "Address2",
                    "value": "Adresse 2",
                    "tooltip": "",
                    "label": "SR_AL_ADDRESS2",
                    "valueLength": 80,
                    "addressType": "PersonPrivateAddress"
                }
            ],
            [
                {
                    "tableRight": null,
                    "fieldProperties": {},
                    "name": "Zipcode",
                    "value": "6000",
                    "tooltip": "",
                    "label": "SR_AL_POSTCODECITY",
                    "valueLength": 12,
                    "addressType": "PersonPrivateAddress"
                },
                {
                    "tableRight": null,
                    "fieldProperties": {},
                    "name": "City",
                    "value": "Kolding",
                    "tooltip": "",
                    "label": "",
                    "valueLength": 80,
                    "addressType": "PersonPrivateAddress"
                }
            ]
        ],
        "street": {
            "atypeIdx": "QuoteShippingAddress",
            "address1": "",
            "address2": "",
            "address3": "",
            "city": "",
            "county": "",
            "state": "",
            "zipcode": "",
            "formatted": ""
        },
        "postal": null,
        "formatted": null
    },
    "addressType": "QuoteShippingAddress",
    "countryId": 208
}

Object I've fetched from dev-tools:

{
    "QuoteVersionId": 52061,
    "Address": {
        "TableRight": null,
        "FieldProperties": {},
        "Wgs84Latitude": 0,
        "Wgs84Longitude": 0,
        "LocalizedAddress": [
            [
                {
                    "TableRight": null,
                    "FieldProperties": {},
                    "Name": "Address1",
                    "Value": "Adresse 11",
                    "Tooltip": "",
                    "Label": "SR_AL_ADDRESS1",
                    "ValueLength": 80,
                    "AddressType": "PersonPrivateAddress"
                }
            ],
            [
                {
                    "TableRight": null,
                    "FieldProperties": {},
                    "Name": "Address2",
                    "Value": "Adresse 22",
                    "Tooltip": "",
                    "Label": "SR_AL_ADDRESS2",
                    "ValueLength": 80,
                    "AddressType": "PersonPrivateAddress"
                }
            ],
            [
                {
                    "TableRight": null,
                    "FieldProperties": {},
                    "Name": "Zipcode",
                    "Value": "6000",
                    "Tooltip": "",
                    "Label": "SR_AL_POSTCODECITY",
                    "ValueLength": 12,
                    "AddressType": "PersonPrivateAddress"
                },
                {
                    "TableRight": null,
                    "FieldProperties": {},
                    "Name": "City",
                    "Value": "Kolding",
                    "Tooltip": "",
                    "Label": "",
                    "ValueLength": 80,
                    "AddressType": "PersonPrivateAddress"
                }
            ]
        ],
        "Street": {
            "AtypeIdx": "QuoteShippingAddress",
            "Address1": "Adresse 1",
            "Address2": "Adresse 2",
            "Address3": "",
            "City": "Kolding",
            "County": "",
            "State": "",
            "Zipcode": "6000",
            "Formatted": "Adresse 1\nAdresse 2\n60000 Kolding\n"
        },
        "Postal": null,
        "Formatted": null
    },
    "AddressType": "QuoteShippingAddress",
    "CountryId": 208
}

 

 

 

dfd

8. Apr. 2025 | 08:00 AM

Alle Antworten (1)

Hi Kasper,

Try only posting the required fields instead of setting LocalizedAddress/street/post/formatted. If you want to set the QuoteShippingAddress, only set the Street portion, if you want to set the QuoteBillingAddress, only set the Postal portion.

Do note that this should work in CRMScript, see this thread for a code sample: https://community.superoffice.com/en/technical/forums/api-forums/service-crmscript/set-userdefined-delivery-address-from-quote-by-scripts/

8. Apr. 2025 | 03:39 PM

Antwort hinzufügen