This file contains hidden or 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
| #!/usr/bin/env node | |
| 'use strict'; | |
| // Stream unlimited rows into a Sql Server table. | |
| // WARNING!!! WE DROP and RE-CREATE the table. Then stream the data into it. | |
| // Source stream must be an object stream. Object property names must match | |
| // table column names. Since SQL Server isn't case sensitive, don't think case |
This file contains hidden or 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
| 'use strict'; | |
| const Readable = require('stream').Readable; | |
| // Easily turn anything into a readable stream. | |
| // This is pretty much taken verbatim from the node documentation. Why re-invent | |
| // the wheel? | |
| // https://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding |
This file contains hidden or 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
| 'use strict'; | |
| // This is a working example of a readable stream sending rows to insert into | |
| // SQL Server. | |
| const Readable = require('stream').Readable; | |
| const mssql = require('mssql'); | |
| const MsSqlStreamInsert = require('../../lib/source/mssql-stream-insert'); | |
| const showProgress = require('../../lib/transform/show-progress')(); | |
| const options = require('../../.config'); |
This file contains hidden or 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
| global with sharing class CertifiedFacilityWordPressSync implements Schedulable, Database.Batchable<sObject>, Database.AllowsCallouts { | |
| class WordpressSyncJobException extends Exception {} | |
| global static String scheduleIt(String jobName, String CRON_EXP) { | |
| CRON_EXP = CRON_EXP != NULL ? CRON_EXP : '0 0 0/1 1/1 ? '; | |
| jobName = jobName == null ? 'Certified Facility WordPress Sync' : jobName; | |
| CertifiedFacilityWordPressSync cfwp = new CertifiedFacilityWordPressSync(); | |
| return System.schedule(jobName, CRON_EXP, cfwp); | |
| } |
This file contains hidden or 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
| global with sharing class CertifiedFacilityWordPressSync implements Schedulable, Database.Batchable<sObject>, Database.AllowsCallouts { | |
| class WordpressSyncJobException extends Exception {} | |
| global static String scheduleIt(String jobName, String CRON_EXP) { | |
| CRON_EXP = CRON_EXP != NULL ? CRON_EXP : '0 0 0/1 1/1 ? '; | |
| jobName = jobName == null ? 'Certified Facility WordPress Sync' : jobName; | |
| CertifiedFacilityWordPressSync cfwp = new CertifiedFacilityWordPressSync(); | |
| return System.schedule(jobName, CRON_EXP, cfwp); | |
| } |
This file contains hidden or 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
| public with sharing class DuesCalculator { | |
| public DuesCalculator() { | |
| } | |
| public Decimal getAnnualDues(Id contactId) { | |
| return 1; | |
| } |
This file contains hidden or 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
| String MEMBERSHIP_RECORD_TYPE = '01236000000nXvOAAU'; | |
| void addProducts(List<Opportunity> opps) { | |
| List<OpportunityLineItem> olis = new List<OpportunityLineItem>(); | |
| Id oppId = null; | |
| for (Opportunity o : opps) { | |
| PricebookEntry pbe = getPricebookEntry('NEW_MEMBERSHIP'); | |
| if (o.Id == oppId) { |
This file contains hidden or 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
| public void lock() { | |
| List<Donation_Designation__c> dds = getRowsToLock(); | |
| List<Opportunity> ops = getOppList(dds); | |
| System.debug('Size: ' + dds.size()); | |
| for (Donation_Designation__c d : dds) { | |
| d.GL_Lock_Date__c = Date.parse('3/29/2016'); | |
| } | |
| for (Opportunity o : ops) { | |
| o.GL_Lock_Date__c = Date.parse('3/29/2016'); | |
| } |
This file contains hidden or 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
| select * | |
| from dbo.ConstituentAttributes as ca | |
| inner join dbo.CONSTITUENT as con on ca.PARENTID = con.id | |
| inner join dbo.attributetypes as at on ca.attributetypesid = at.attributetypesid | |
| inner join dbo.TABLEENTRIES as te on te.CODETABLESID = at.CODETABLESID | |
| inner join dbo.CODETABLES as ct on ct.CODETABLESID = at.CODETABLESID | |
| where at.recordtype = 1 | |
| and at.TYPEOFDATA > 5 | |
| -- codetables will tell you the category, (Ex. Magazine) and tableentries will tell you a specific value, (Ex, Spring 05) |
This file contains hidden or 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
| /** | |
| * Automatically creates a membership renewal opportunity so many days | |
| * before the old membership expires. | |
| * | |
| * New membership starts on the expiration date of the old membership and is | |
| * valid for specified number of months. | |
| * | |
| * We created the following opp custom fields specifically for this purpose. | |
| * | |
| * * Membership_Auto_Renew_Days_Prior__c |