【发布时间】:2025-12-19 10:50:07
【问题描述】:
目前我正在尝试将值添加到我们在 Salesforce 中使用的自定义选项列表中。 目前,经过多天的尝试,我能够像这样创建一个新的自定义选项列表:
url2 = "https://INSTANCE.salesforce.com/services/Soap/m/45.0/ORGID"
headers2 = {'content-type': 'text/xml; charset=utf-8', "SOAPAction":"POST"}
body2 = """<?xml version="1.0" encoding="utf-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:apex="http://soap.sforce.com/2006/08/apex"
xmlns:cmd="http://soap.sforce.com/2006/04/metadata"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<cmd:SessionHeader>
<cmd:sessionId>{0}</cmd:sessionId>
</cmd:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<create xmlns="http://soap.sforce.com/2006/04/metadata">
<metadata xsi:type="CustomField">
<fullName>Case.verursacht_durch_MA2__c</fullName>
<label>verursacht_durch_MA2</label>
<type>Picklist</type>
<valueSet>
<restricted>true</restricted>
<valueSetDefinition>
<sorted>false</sorted>
<value>
<fullName>ValueTest</fullName>
<default>false</default>
<label>ValueTest</label>
</value>
</valueSetDefinition>
</valueSet>
</metadata>
</create>
</soapenv:Body>
</soapenv:Envelope>""".format(sessionId)
response2 = requests.post(url2,data=body2,headers=headers2)
现在我正在尝试使用 xml 更新现有选项列表中的值。 但是当我试图用更新标签替换创建标签时,它告诉我像“fullName”“label”等标签在这个位置是无效的。
任何帮助将不胜感激!
【问题讨论】:
标签: python api soap salesforce