Go Back
Salesforce to Peoplesoft: Academic Advisor Sync
Publisher
:
Run In Lingk
Description
This recipe retrieves academic advisor emplid from Salesforce and writes the data back to Peoplesoft
Browse the knowledge base
Twitter
E-Mail
# _____ _ _____ __ # | __ \ (_) |_ _| / _| # | |__) |___ ___ _ _ __ ___ | | _ __ | |_ ___ # | _ // _ \/ __| | '_ \ / _ \ | | | '_ \| _/ _ \ # | | \ \ __/ (__| | |_) | __/ _| |_| | | | || (_) | # |_| \_\___|\___|_| .__/ \___| |_____|_| |_|_| \___/ # | | # |_| # Project Name - Salesforce to Peoplesoft: Academic Advisor Sync # Recipe URL - https://app.lingk.io/a/10932/tf/19184 # Description - 14 - Salesforce to Peoplesoft: Academic Advisor Sync # This recipe retrieves academic advisor emplid from Salesforce and writes the data back to Peoplesoft # Read the last successful recipe runtime from the environment variable. # Read contact where Academic_Advisor_Changed_Date_Time__c >= last success run time. # Set current date time in env variable. # Post University student and advisor id to PS. # Systems - Peoplesoft, Salesforce # Connectors - HttpV2, Salesforce # Data Flows - Single Direction # Connection Type - API to API # Data Models ## Peoplesoft Models Used: #1. PS_STDNT_TEST_COMP ## Salesforce Objects Used: #1. Contact # Add Recipe notes / Change log information here! # _____ _ # / ____| | | # | | ___ _ __ _ __ ___ ___| |_ ___ _ __ ___ # | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| # | |___| (_) | | | | | | | __/ (__| || (_) | | \__ \ # \_____\___/|_| |_|_| |_|\___|\___|\__\___/|_| |___/ # # CONNECTORS specify what data will be pulled into the in-memory database during processing connectors: # Configure HTTP & Salesforce credentials in your Environment before running this recipe # HTTP Setup - https://help.lingk.io/en/articles/304-http-connector-setup-guide # Salesforce Setup - https://help.lingk.io/en/articles/267-salesforce-connector-setup-guide ###### Start - Salesforce Reader connectors ###### ## Inbound Academic Advisor ## - name: sfContactReader type: salesforceReader delayedRead: true properties: useBearerToken: true query: | SELECT Id, University_Student_ID__c, Academic_Advisor__c, Academic_Advisor__r.Mid_State_ID__c FROM Contact WHERE (University_Student_ID__c != NULL OR University_Student_ID__c != '') AND (Academic_Advisor__c != NULL OR Academic_Advisor__c != '') AND Academic_Advisor_Changed_Date_Time__c >= {{executionContext.lastRecipeExecutionTime.lastSuccessfulRunDate}} schema: fields: - name: 'Id' type: 'string' - name: 'University_Student_ID__c' type: 'string' - name: 'Academic_Advisor__c' type: 'string' - name: 'Academic_Advisor__r.Mid_State_ID__c' type: 'string' ###### End - Salesforce Reader connectors ###### ###### Start - HTTP Reader connectors ###### ## PeopleSoft writer # Environment variables documentation - https://help.lingk.io/en/articles/202-custom-environment-variables - name: peopleSoftAdvisorWriter type: httpReader delayedRead: true parameterizedBy: peopleSoftApiRequestBatch properties: url: {{env.var.url}} headersJson: > { "Content-Type": "application/json", "Authorization": "Basic {{env.var.token}}" } httpMethod: POST body: | {{var|tojson}} ###### End - HTTP Reader connectors ###### # _______ _ # |__ __| | | # | | __ _ ___| | _____ # | |/ _` / __| |/ / __| # | | (_| \__ \ <\__ \ # |_|\__,_|___/_|\_\___/ # Batch task used for parameterized by statements/connectors tasks: - name: batcher type: dataOperation function: batch parameters: inputBatchGroupBy: Emplid: desc inputBatchSize: 1 inputBatchFields: "*" batchedColumnAlias: output # _____ _ _ _ # / ____| | | | | | # | (___ | |_ __ _| |_ ___ _ __ ___ ___ _ __ | |_ ___ # \___ \| __/ _` | __/ _ \ '_ ` _ \ / _ \ '_ \| __/ __| # ____) | || (_| | || __/ | | | | | __/ | | | |_\__ \ # |_____/ \__\__,_|\__\___|_| |_| |_|\___|_| |_|\__|___/ # STATEMENTS specify how the data should be processed while in memory statements: #******************************************************************** D I S C L A I M E R *********************************************************************************************** # * # Note that in an effort to keep recipes optimized for DPH (Data Processing Hours), print statements should be commented out after development has concluded for a recipe. * # For more information on DPH optimization, please visit the following help article - https://help.lingk.io/en/articles/212-minimizing-data-processing-hours-on-the-lingk-platform * # * #******************************************************************** D I S C L A I M E R *********************************************************************************************** ## Read last recipe run time from environment variable # environment variables documentation - https://help.lingk.io/en/articles/202-custom-environment-variables - statement: | (lastRecipeExecutionTime) => SELECT to_timestamp("{{env.vars.acdAdvisorLastRunTime}}") `lastSuccessfulRunDate` #- statement: print lastRecipeExecutionTime - statement: INSERT lastRecipeExecutionTime INTO executionContext ## Select contact from SF where academic advisor change date >= last run time - statement: REFRESH sfContactReader - statement: (sfContactReaderCount) => SELECT COUNT(*) FROM sfContactReader #- statement: print sfContactReaderCount ## Post request for inbound PS academic advisor API - statement: | (peopleSoftApiRequest) => SELECT IFNULL(University_Student_ID__c, '') `Emplid`, IFNULL(`Academic_Advisor__r.Mid_State_ID__c`, '') `AdvisorID` FROM sfContactReader WHERE IFNULL(Academic_Advisor__c, '') != '' #- statement: print peopleSoftApiRequest - statement: (peopleSoftApiRequestCount) => SELECT COUNT(*) FROM peopleSoftApiRequest #- statement: print peopleSoftApiRequestCount # Add request data to batch task # This statement executes a batch process task where the name, inputTable, outputTable and the results are the parameters needed - statement: | execute task --name batcher --inputTable peopleSoftApiRequest --outputBatchTable peopleSoftApiRequestBatch --result myResult #- statement: print myResult #- statement: print peopleSoftApiRequestBatch - statement: REFRESH peopleSoftAdvisorWriter #- statement: PRINT peopleSoftAdvisorWriter ###### Start - Update Dates env vars ###### ## update current date time in environment variable - statement: (currentDateTime) => SELECT from_utc_timestamp(current_timestamp(), 'America/New_York') `acdAdvisorLastRunTime` - statement: UPDATE currentDateTime INTO env.vars ###### End - Update Dates env vars ###### # Add more statements to convert, join, aggregrate, transform, and integrate your data
Salesforce to PeopleSoft: Application Sync
Peoplesoft to Salesforce: Course Connection Sync