Topic
IDでSobjectの取得
Salesforce組織のユーザ名、パスワード、Apiバージョン、Product/Sandboxを設定してください。
Accountを取得する
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| from SalesforceXytoolsCore import *
import pprint
config = {
"api_version": 42.0,
"username": "sfdc username",
"password": "sfdc password",
"security_token": "",
"is_sandbox": True
}
soap_api = Soap(username=config["username"],
password=config["password"],
security_token=config["security_token"],
sandbox=config["is_sandbox"],
version=config["api_version"]
)
print('hello SalesforceXytoolsCore Test start')
Account = soap_api.get_sobject("Account")
"""
get a Sobject in Salesforce
"""
acc_id="set your sobject id"
account1 = Account.get(acc_id)
pprint.pprint(account1)
|
外部キーでSobjectの取得
1
2
3
4
5
6
| """
get a Sobject by External ID
"""
account1 = Account.get_by_custom_id('My_Custom_ID__c', 'custom_id')
pprint.pprint(account1)
|
IDでSobjectの更新
1
2
3
4
5
6
7
|
"""
update a Sobject in Salesforce
"""
acc_id="set your sobject id"
account1 = Account.update(acc_id,{'LastName': 'sfdc'})
pprint.pprint(account1)
|
IDでSobjectの削除
1
2
3
4
5
| """
delete a Sobject in Salesforce
"""
acc_id="set your sobject id"
Account.delete(acc_id)
|