在过去的几天里,我一直试图提到一个使用简单的销售力量和闲聊的人,但都没有成功。我尝试过不同的方法,但都没有给我带来令人满意的结果。
这很好,而且我能够为特定的父母创建一个FeedItem,但是@mention呈现为文本。
record = pd.DataFrame({'ParentId':['parent_salesforce_id']
,'Body':['{%salesforce_id} Test.']
,'Type':['TextPost']})
record = record.to_dict(orient="records")
results = sf.bulk.feeditem.insert(record)
results到目前为止,我已经尝试过:
在聊天API文档之后,我应该使用messageSegments来提及某个人,但是我的所有方法都失败了。
使用messageSegments的示例代码:
record = pd.DataFrame({'ParentId': 'parent_salesforce_id'
,'Body': [[{'messageSegments': {'text' : 'Test'}}]]
,'Type': 'TextPost'})
record = record.to_dict(orient="records")
results = sf.bulk.feeditem.insert(record)
results
Error message:
Out[14]: [{'success': False,
'created': False,
'id': None,
'errors': [{'statusCode': 'INVALID_FIELD',
'message': 'Unexpected JsonMappingException: Cannot deserialize instance of textarea from START_ARRAY value [ or request may be missing a required field\n at [Source: java.util.zip.GZIPInputStream@74f8b7a1; line: 1, column: 35]',
'fields': []}]},
{'success': False,
'created': False,
'id': None,
'errors': [{'statusCode': 'INVALID_FIELD',
'message': "Unexpected JsonMappingException: No such column 'messageSegments' on sobject of type FeedItem",
'fields': []}]},
{'success': False,
'created': False,
'id': None,
'errors': [{'statusCode': 'INVALID_FIELD',
'message': "Json Deserialization failed on token 'text' and has left off in the middle of parsing a row. Will go to end of row to begin parsing the next row",
'fields': ['text']}]}]我一直在使用与之前的堆栈帖子相同的方法。有人能帮我吗?提前谢谢你。
[1]: https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm
[2]: https://stackoverflow.com/questions/55165029/mentioning-chatter-request-sfdc-using-simple-salesforce-in-python发布于 2022-07-26 07:50:04
我在一个流中解决了它,但它也应该在Apex代码中工作。试着用括号:
'@['+salesforce_id+']'https://stackoverflow.com/questions/73118866
复制相似问题