Skip to content

Instantly share code, notes, and snippets.

@Damecek
Created October 12, 2023 14:44
Show Gist options
  • Select an option

  • Save Damecek/d4daa871f356c6dfdadcbafe598d28d9 to your computer and use it in GitHub Desktop.

Select an option

Save Damecek/d4daa871f356c6dfdadcbafe598d28d9 to your computer and use it in GitHub Desktop.
Queries and returns url for the last created WI
#!/bin/bash
# Execute the SOQL query
QUERY_RESULT=$(sf data query -o carvago-prod --query "SELECT Id FROM sf_devops__Work_Item__c ORDER BY CreatedDate DESC LIMIT 1" --result-format csv)
# Get the record ID from the result. We select the second line (actual data) and then cut by ',' to get the ID.
RECORD_ID=$(echo "$QUERY_RESULT" | awk 'NR==2' | cut -d',' -f2)
# Form the URL
URL="https://carvago.lightning.force.com/sf_devops/DevOpsCenter.app?workItemId=$RECORD_ID"
echo $URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment