使用 Zapier Push 从 URL 中提取 Salesforce 记录 ID

Extract Salesforce record Id from URL with Zapier Push

我需要一种使用 Zapier Push 从 URL 中提取 Salesforce 记录 ID 的方法。如何在字符串中找到与 Id 开头匹配的前 3 个字符,例如 006,然后 return 后面的一组字符?

url 的格式如下:

https://useindio.lightning.force.com/lightning/r/Opportunity/006f400000AiVufAAF/view

来自 Zapier 平台团队的 David。好问题!

每当您想从字符串中提取数据并且知道字符串的确切格式时,正则表达式就是答案。

假设您想在 006 之后抓取任何东西(并且您知道它会一直存在),您可以使用正则表达式 006(\w{15}) (more info), which will find the 15 characters after that. If you know the surrounding url will always be the same, you could easily grab the whole ID by anchoring via Opportunity and view: \/Opportunity\/(.*)\/view (more info).

无论如何,这里有关于设置格式化程序 zap here, or you could do it in code (JS Example, Python Example) 的信息。

如果您还有其他问题,请告诉我!