/python-functions

Sample Python Salesforce Function

Primary LanguagePython

Warning As per the Salesforce Functions Retirement announcement, this repository is now archived.

Sample Python Function

Install the Python function dependencies:

cd functions/python_watermark
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Start the local function container:

sf run function start

Retrieve a ContentDocument ID by running this SOQL query (tip: use the VSCode command):

SELECT PathOnClient, ContentDocumentId FROM ContentVersion WHERE IsLatest=true

Call the local function (make sure to replace the ContentDocument ID):

sf run function --function-url http://localhost:8080 --payload '{"docId": "069DK000001i2QBYAY"}'