Newer Version Available
SOAP API Examples
Use SOAP API to create, update, or delete a record with Custom Address Fields
data.
Create a New Account with Data in a Custom Address Field
This example creates an Account record which includes address data stored in the Mailing
Address custom address
field.
1<?xml version="1.0" encoding="utf-8"?>
2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
3 xmlns:urn="urn:enterprise.soap.sforce.com"
4 xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6 <soapenv:Header>
7 <urn:SessionHeader>
8 <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
9 </urn:SessionHeader>
10 </soapenv:Header>
11 <soapenv:Body>
12 <urn:create>
13 <urn:sObjects xsi:type="urn1:Account"> <!--Zero or more repetitions:-->
14 <Name>Puneet Ahmedabad Account</Name>
15 <Mailing_Address__City__s>Ahmedabad</Mailing_Address__City__s>
16 <Mailing_Address__Street__s>102 Suryakoti</Mailing_Address__Street__s>
17 <Mailing_Address__PostalCode__s>380022</Mailing_Address__PostalCode__s>
18 <Mailing_Address__StateCode__s>GJ</Mailing_Address__StateCode__s>
19 <Mailing_Address__CountryCode__s>IN</Mailing_Address__CountryCode__s>
20 <Mailing_Address__Latitude__s>37.775</Mailing_Address__Latitude__s>
21 <Mailing_Address__Longitude__s>-122.418</Mailing_Address__Longitude__s>
22 </urn:sObjects>
23 </urn:create>
24 </soapenv:Body>
25</soapenv:Envelope>Update Data Within a Custom Address Field on a Record
This example updates the data stored in the Mailing Address custom address field for record ID
001XXXXXXXXXXXXXXX.
1<?xml version="1.0" encoding="utf-8"?>
2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
3 xmlns:urn="urn:enterprise.soap.sforce.com"
4 xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6 <soapenv:Header>
7 <urn:SessionHeader>
8 <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
9 </urn:SessionHeader>
10 </soapenv:Header>
11 <soapenv:Body>
12 <urn:update>
13 <urn:sObjects xsi:type="urn1:Account">
14 <Id>$001XXXXXXXXXXXXXXX</Id>
15 <Mailing_Address__Street__s>20 Udhyog Nagar</Mailing_Address__Street__s>
16 <Mailing_Address__City__s>Surendranagar</Mailing_Address__City__s>
17 <Mailing_Address__PostalCode__s>363001</Mailing_Address__PostalCode__s>
18 <Mailing_Address__StateCode__s>GJ</Mailing_Address__StateCode__s>
19 <Mailing_Address__CountryCode__s>IN</Mailing_Address__CountryCode__s>
20 <Mailing_Address__Latitude__s>22.757580</Mailing_Address__Latitude__s>
21 <Mailing_Address__Longitude__s>71.619350</Mailing_Address__Longitude__s>
22 </urn:sObjects>
23 </urn:update>
24 </soapenv:Body>
25</soapenv:Envelope>Delete Data Within a Custom Address Field from a Record
To delete address data stored within a custom address field on a record, update the record.
This example deletes the address stored in the Mailing Address custom address field
on the Account with record with ID 001XXXXXXXXXXXXXXX.
1<?xml version="1.0" encoding="utf-8"?>
2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
3 xmlns:urn="urn:enterprise.soap.sforce.com"
4 xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6 <soapenv:Header>
7 <urn:SessionHeader>
8 <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
9 </urn:SessionHeader>
10 </soapenv:Header>
11 <soapenv:Body>
12 <urn:update>
13 <urn:sObjects xsi:type="urn1:Account">
14 <Id>$001XXXXXXXXXXXXXXX</Id>
15 <Name>Acc updated</Name>
16 <urn:fieldsToNull>Mailing_Address__Street__s</urn:fieldsToNull>
17 <urn:fieldsToNull>Mailing_Address__City__s</urn:fieldsToNull>
18 <urn:fieldsToNull>Mailing_Address__PostalCode__s</urn:fieldsToNull>
19 <urn:fieldsToNull>Mailing_Address__StateCode__s</urn:fieldsToNull>
20 <urn:fieldsToNull>Mailing_Address__CountryCode__s</urn:fieldsToNull>
21 <urn:fieldsToNull>Mailing_Address__Latitude__s</urn:fieldsToNull>
22 <urn:fieldsToNull>Mailing_Address__Longitude__s</urn:fieldsToNull>
23 </urn:sObjects>
24 </urn:update>
25 </soapenv:Body>
26</soapenv:Envelope>Delete a Record That Contains Data in a Custom Address Field
This example deletes the Account record with ID 001XXXXXXXXXXXXXXX. When a record is deleted, all data for that record
is deleted, including the custom address field
information.
1<?xml version="1.0" encoding="utf-8"?>
2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
3 xmlns:urn="urn:enterprise.soap.sforce.com"
4 xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6 <soapenv:Header>
7 <urn:SessionHeader>
8 <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
9 </urn:SessionHeader>
10 </soapenv:Header>
11 <soapenv:Body>
12 <urn:delete>
13 <Id>$001XXXXXXXXXXXXXXX</Id>
14 </urn:delete>
15 </soapenv:Body>
16</soapenv:Envelope>