-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utilities/contacts-from-sf.sh for processing Salesforce contact d…
…ata.
- Loading branch information
Jon Agland
committed
Oct 13, 2017
1 parent
78d613d
commit 6388bff
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/bin/bash | ||
| # This script processes a Salesforce report "UKfed-contacts-export" which lists all contacts with | ||
| # UK Federation Contact Roles and their corresponding Jisc Organisation ID (ukforg) and Organisation Name | ||
| # | ||
| # The current report can be found here https://eu3.salesforce.com/00Ow0000007MXhK, it needs to be exported as a CSV file | ||
| # which ends up as 'reportnnnnnnnnnnnnn.csv' | ||
| # | ||
| # The input to the script is the above CSV file. | ||
| # | ||
| # The output of the script is as follows; | ||
| # | ||
| # * A copy of the Salesforce report in $CSVDEST | ||
| # * A list of Management Contact email addresses in $MGMTDEST | ||
| # * A list of all contact email addresses in $CONTACTDEST | ||
| # | ||
| # To use this script please follow the process here; | ||
| # | ||
| # https://repo.infr.ukfederation.org.uk/ukf/ukf-systems/wikis/HOW-to-process-UKfed-contacts-export-report | ||
| # | ||
| # Author: Jon Agland <jon.agland@jisc.ac.uk> | ||
| # | ||
|
|
||
| SFREPORTNAME="UKfed-contacts-export" | ||
| CSVDEST=../../ukf-data/contacts/sf-contacts.csv | ||
| CONTACTDEST=../../ukf-data/contacts/sf-contacts.txt | ||
| MGMTDEST=../../ukf-data/contacts/sf-contacts-mc.txt | ||
|
|
||
| if [ -z "$1" ]; then | ||
| echo "ERROR: No file name supplied" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "$1" ]; then | ||
| echo "ERROR: file $1 does not exist" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! grep -q \"$SFREPORTNAME\" $1; then | ||
| echo "ERROR: this doesn't appear to be the output of $SFREPORTNAME" | ||
| exit 2 | ||
| fi | ||
|
|
||
| cat $1 | awk -F\, '{ print $1 }' | grep @ | sed -e 's/\"//g' | sort -u > $CONTACTDEST | ||
| grep "\,\"UK Federation Management Contact\"" $1 | awk -F\, '{ print $1 }' | grep @ | sed -e 's/\"//g' | sort -u > $MGMTDEST | ||
|
|
||
| cp $1 $CSVDEST | ||
|
|