►
From YouTube: Support Ops - Zendesk - ZD-SFDC US Federal Sync
Description
Jason Colyer, Support Operations Manager, takes us through how the ZD-SFDC US Federal sync works
A
Hey
y'all
jason
collier
support
operations
manager
here,
I'm
joined
by
james
and
caleb
today,
we're
gonna
go
over
the
zendesk
salesforce
us
federal,
sync
scripts,
the
code
and
how
all
that
jazz
works.
So
let
me
share
my
screen
and
we'll
kind
of
get
started.
A
Right
on
so
right
now
we're
looking
at
is
the
v4
branch
hasn't
quite
been
merged
into
the
main
master
branch.
Yet,
but
this
is
the
new
version
of
the
code
and
yeah
right
now.
We've
got
our
readme
file,
it
kind
of
tells
you
like
the
required
gems,
which
needs
to
be
updated,
the
file
tree
path
and
then
the
soqo
queries
which
we'll
go
more
over
those
when
we
actually
go
to
the
scripts,
but
the
big
meat
and
potatoes
of
how
everything
works.
A
At
least
sync
wise
is
the
ci
cd
script
right
now
it's
using
ruby,
2.6
later
version.
I'm
gonna
update
that
to
like
three
or
whatever,
but
the
stages
we
basically
have
are
the
gather,
compare
sync
and
then
we're
syncing
users
as
well,
because
federal
actually
does
contact
syncing
a
much
smaller
pool
of
users
and
orgs
were
able
to
actually
do
that.
There's
like
a
future
iteration
where
that
won't
be
a
thing,
but
we'll
kind
of
cross
that
bridge
when
we
get
there.
A
A
Our
before
script
is
pretty
simple.
It's
going
to
echo
out,
you
know
it's
going
to
print
out
the
ruby
version
and
then
install
bundler
and
then
run
bundle.
Some
people
take
different
approaches.
I
like
this
approach,
just
because
it's
consistent
between
scripts
of
yeah,
I'm
pretty
much
always
going
to
just
install
bundler
and
then
run
bundle
and
then
it'll
have
a
gem
file
that
will
tell
it
what
to
actually
install.
A
B
A
It's
running
the
gathers
and
desk
organization
scripts,
which
we'll
go
over
in
a
bit.
It's
going
to
create
an
artifact
that
lasts
four
hours
and
it
is
going
to
be
named
zendesk
forge.json,
not
original
naming
so
that's
just
kind
of
what
we
go
with
the
precinct,
sf
board
report
or
precinct
salesforce
organization
report.
It's
doing
much
the
same
thing:
it's
gathering
salesforce
accounts.
A
This
one,
however,
creates
two
different
artifacts
we've
got
the
salesforce
accounts
which
we'll
actually
be
using
for
the
sync,
and
then
we
have
this
account
problems
json,
which
we
can
download
later,
and
this
will
tell
us
what
problems
are
going
to
occur,
what
are
being
skipped
in
the
sink
when
we
go
over
the
actual
salesforce
stuff,
we'll
kind
of
go
over,
that
we
got
the
zd
user
report,
which
is
doing
the
same
thing.
Just
gathering,
zendesk
users,
salesforce
user
report
again
same
thing,
just
gathering
salesforce
contacts.
A
We
have
the
precinct
comparison
for
orgs,
which
is
going
to
compare
them
and
create
a
creates
and
updates
file
to
let
the
sync
know
this
is
what
to
create.
This
is
what
to
update.
I
use
needs
here
to
basically
say
I
need
these
precinct
zd
or
report
and
precinct
sf
org
report
jobs
to
succeed.
Without
those
we
can't
proceed
because
it
needs
the
artifacts
they
create
the
user
comparison,
it's
kind
of
the
same
thing,
but
for
users,
and
then
we
have
the
sync
organization
and
sync
users
job
these
require.
A
So
beyond
that,
here's
our
gem
file
right
now
not
a
lot
here,
because
we
basically
just
need
json,
oj
and
restforce
a
fun
fact
about
that.
You
can
click
these
and
it'll
actually
take
you
to
the
rubygems
since
that's
the
source.
A
That's
always
like
that
feature
in
gitlab,
but
basically
because
oj
is
going
to
require
faraday,
because
that's
how
oj
works,
I
don't
have
to
say
I
need
faraday,
because
it's
gonna
already
be
installed
with
oj,
but
basically,
when
we
run
bundle,
it's
just
gonna
install
these
gems
and
json
is
a
library.
It's
not
it's,
it's
a
gym,
but
also
it's
not
a
gym.
It's
weird
and
then
rest
forces
salesforce's
api
gym.
A
So
our
scripts
here
are
pretty
much.
How
a
lot
of
this
is
running
and
I'll
show
you
just
one
of
them,
because
they're
all
gonna
follow
the
same
format
so
like
gathers
in
dashboards,
it's
going
to
require
the
zdsfdc
sync
us
federal
file,
and
then
it's
just
going
to
call
zendesk
salesforce
sync,
us
federal,
zendesk
gather
organizations
run
they're
all
going
to
follow
this
format.
They're
pretty
much
all
going
to
be
calling
different
libraries
that
we've
built
and
doing
the
run
function,
so
the
more
important
stuff
would
be
what's
in
lib.
A
This
is
our
main
file.
This
is
what
we're
actually
requiring,
and
all
this
is
is
declaring
the
module
zendesk
salesforce.
Sync
us
federal.
I
really
need
to
shorten
that
name
somehow
and
it's
requiring
bundler
setup
and
then
doing
a
bundler
required
default.
This
is
fancy
talk
of
hey,
so,
whatever
I
said,
I
needed
in
the
gym
file
go
ahead
and
tell
the
script
that
I
require
those
gems
so
that
they're
already
loaded
and
ready
to
go
and
then
from
there
it's
going
to
require
the
client
file.
A
A
I
set
up
a
hash
of
retry
options
here
and
basically
we're
going
to
pass
this
into
faraday
and
it's
going
to
tell
it
how
to
handle
failures
and
most
common
failure.
Being
I
timed
out,
I
lost
the
socket.
I
dropped
a
packet,
nothing
ruins
the
script
more
than
I
dropped
a
packet,
so
I
stopped
running
completely.
So
this
is
just
a
way
of
saying:
hey!
A
Do
five
max
retries
wait
a
second
between
each
one,
there's
an
interval
randomness
of
0.5,
which
kind
of
it
multiplies
by
the
interval
to
kind
of
give
it
a
range.
So
in
this
case
point
half
a
second
to
a
second
is
what
it's
going
to
weight.
A
The
back
off
factor
is
two:
that's
if
it
gets
an
error
that
tells
it
hey,
you've
been
api,
limited
back
off
factor
tells
it
okay,
wait
this
much
time
back
off.
Factor
in
this
case
is
two
seconds.
A
I've
never
actually
used
that
one
in
the
scripting,
but
it's
a
good
thing
to
put
in
place
and
then
we've
got
exceptions,
and
this
is
where
it
actually
will
use
all
this
stuff.
So
exceptions
for
this
would
be
connection
failed.
Timeout,
that's
the
exceptions.
It's
actually
looking
for
to
use
these
retry
options
beyond
that
we're
making
a
salesforce
object
at
salesforce
makes
it
kind
of
a
global
variable
if
you've
never
seen
this
symbol
before
double
pipe
equal.
It's
a
really
fancy
ruby
term
for
set
it
to
this.
A
A
In
this
case,
I'm
calling
the
restforce
and
giving
in
all
the
required
variables
that
it
needs
to
actually
generate
a
salesforce
connection,
zendesk
kind
of
the
same
thing,
but
instead
of
using
a
gym,
I'm
actually
using
faraday.
I
haven't
found
a
zendesk
api
gym
that
I
really
like
there's
a
couple.
I've
played
with
they're
okay,
but
they
kind
of
fall
short
in
some
areas,
especially
on
retries.
That's
where
they
really
fall
short
on.
A
So
I
ended
up
just
going
pure
faraday
on
this
one
and
for
the
faraday
connection,
you
know
we're
giving
it
the
zendesk
federal,
url,
the
api
url
and
then
we're
going
to
have
it
make
sure
the
requests
retry
knows
to
use
these
retry
options
we
have
up
here.
A
A
This
isn't
required
for
get
requests
to
the
zendesk
api,
but
any
post
or
put
request
is
absolutely
going
to
require
that
because
it
will
only
take
json
objects
and
then
we're
using
basic
auth,
which
at
some
point
in
the
future,
I
will
update,
because
faraday
is
now
deprecating
basic
auth
to
use
a
different
method,
but
for
now
basically
I
use
my
username
or
the
sync's
username
slash
token,
and
then
the
api
token.
A
And
then
here
I
have
requests
this
pairs
with
the
zendesk
object
and
it's
basically
calling
the
public
send
function,
which
is
a
nice
wrapper
for
faraday,
has
a
bunch
of
like
request,
dot,
get
request,
dot,
post,
request,
output,
request,
dot
delete
instead
of
having
to
worry
about
that
and
remembering
the
exact
right
function
to
use
public
send
will
instead
take
an
http
method,
the
url
and
parameters
and
then
just
use
it
that
way.
A
So
I
can
call
you
know,
request
git,
you
know
google.com
and
it'll
do
a
get
request
at
google.com
instead
of
me
having
to
remember,
is
it
get
or
does
it
get
send
or
whatever
function?
I,
like
public,
send
it's
a
cool
wrapper,
but
we're
passing
all
that
into
a
response
and
then
we're
using
oj,
which
is
a
nice
gem
that
will
take
an
http
response
and
make
it
into
a
ruby
object.
So
it's
nice
and
easy
to
work
with
in
this
case,
I'm
telling
oj
to
load
the
response
body.
A
A
So
we'll
go
with
salesforce
as
a
starting
point.
We
have
the
salesforce
rb,
which
you
saw
the
client
file
require.
All
this
is
doing
is
requiring
the
gather
script,
and
that's
just
so.
I
could
kind
of
separate
stuff
out.
A
So
if
I
go
into
salesforce
here's
the
gather
script,
all
this
is
doing
is
requiring
accounts
and
contacts.
I
like
to
do
it
this
way,
just
to
make
it
a
little
easier
to
read.
If
I
I
mean
you
could
put
all
of
this
in
one
file,
but
it
gets
kind
of
hard
to
read
after
a
while,
so
the
accounts
you
know,
we've
got
our
module,
our
salesforce
class,
our
gather
class
and
then
our
accounts
class,
and
I'm
telling
it
to
inherit
from
client.
A
A
A
The
data
function
see
how
I've
got
a
variable
data
that
I'm
setting
as
a
global
with
the
at
sign
using
this
double
pipe
equal
and
then
I'm
using
the
salesforce
gym
to
run
a
query
and
it's
using
a
query
string
and
then
I'm
taking
the
results
and
mapping
them
to
account
objects.
A
So
the
query
string.
This
is
our
query
string
for
accounts
if
you're
not
familiar
with
sql
or
soql,
which
is
the
salesforce
object,
query
language.
Basically,
what
we're
doing
here
is
I'm
telling
it
what
I
want.
A
What's
the
market
segmentation,
large
smb
pub
sac
account
owner
calc
c,
that's
in
salesforce
account
owner
is
an
object
and
calc
c
is
basically
a
fancy
way
of
saying
right,
so
just
calculate
the
account
object
and
give
me
to
the
account
owner
and
give
me
that
person.
A
This
is
going
to
end
up
returning
a
string
that
will
then
sync
over
number
of
licenses
the
number
of
seats
in
their
license,
their
total
licenses,
the
type
of
account
which
would
be
like
customer
former
customer
prospects,
all
that
fun
stuff
technical
account
manager
name,
which
is
the
name
of
the
the
tam
support
level,
is
the
support
level
that's
determined
based
on
subscriptions,
but
we
actually
have
the
script
doing
a
little
more
with
it.
A
We'll
go
over
that
a
bit
region
which
we
actually
don't
use
in
us
federal,
but
I
wanted
them
kind
of
in
sync
with
what
the
other
scripts
are
doing.
So
I
called
it
anyway
gs
health
score
color,
which
is
the
gain
sight,
health
score
color.
A
I
don't
understand
fully
how
this
health
score
is
determined,
but
my
understanding
is
gainsight
is
using
a
bunch
of
information
about
like
potential
potential
to
renew
emotional
state
stuff,
like
our
non-emotional
state,
you
know,
like
health
state
of
the
account
stuff
like
that
to
determine
a
red,
yellow,
green
color
system
or
null,
which
means
it
hasn't
calculated
anything.
A
Some
people
find
that
useful.
So
we
do
sync
it
over
next
renewal
date
is
going
to
look
at
their
subscriptions
and
look
at
the
next
upcoming
renewal
and
put
that
there
solutions,
architect,
lookup
dot
name.
Basically,
I'm
saying
do
account
solutions,
architect,
lookup
on
the
account
and
then
give
me
the
name
of
the
person
which
we'll
call
down
below
this
is
one
of
the
newer
parts
of
it
right
here.
I'm
calling
a
sub
query
and
I'm
basically
doing
I
want
the
current
subscription
status
the
end
date.
A
The
start
date
and
the
plan
name
from
the
subscriptions
that
are
active
for
the
accounts
that
we're
pulling.
This
will
allow
us
in
the
script
later
to
actually
look
at
the
subscriptions
and
then
ensure
that
the
support
level
matches
what
it
should
be.
It'll
also
allow
us
to
add
tags
in
case
we
have
customers
who
are
I'm
ultimate
in
gold
and
bronze
and
starter.
A
I've
got
all
these
plans,
but
we
want
all
those
tags
present
and
then,
as
we
work
tickets,
we
can
remove
the
ones
not
applicable,
so
we're
adding
we're
asking
for
all
that
from
the
accounts
table
or
accounts
object.
I
should
say
since
soql's
objects
and
then
we've
got
our
where
statement,
which
is
basically
us
being
specific
for
us
federal.
So
we
only
want
customer
former
customer
prospects
yeah.
I
know
that's
kind
of
everything.
A
Everything
but
leads
the
account.
Terry
should
account.
Territory
should
start
with
u.s
pub,
fed
percentage
signs
of
glob,
just
like
in
sql,
glob
being
fancy
term
for
a
wild
card
and
then
we're
doing
basic.
We're
basically
doing
this
right
here,
which
is
using
the
plan.
So
if
their
support
level
is
premium
ultimate
or
expired,
they're
good,
we
want
them
if
they're
basic.
We
also
require
that
their
lice
number
of
licenses
is
over,
is
equal
to
or
over
2
000..
A
A
So
the
salesforce
salesforce
is
going
to
run
that
query
and
then
map
it
into
an
account
object
which
down
here
you'll
see.
This
is
just
turning
all
of
those
into
a
giant
hash
that
will
be
passed
along
into
an
array
and
basically,
what
you're
seeing
here
is
I've
got
some
stuff
like
type
is
down
case,
and
then
I
wanted
to
take
any
spaces
and
make
them
underscores
that
way.
It
follows
camel
casing
for
health
score.
A
I
want
it
to
a
string
and
down
case
to
a
string
is
nice,
because
if
it's
null
it'll
make
it
an
empty
string,
so
it
doesn't
error
out.
It's
just
a
kind
of
nice
way
to
do
that,
but
you
can
see
how
some
of
these
we
have.
We
have.
This
check
account
function.
That
starts
first,
so
check
account
is
one
of
the
newer
stuff.
I've
got
this
plan
called
nine
expired.
A
Basically
we're
going
to
go
through
the
account
subscriptions
if
you're
not
familiar
with
this
right
here,
the
ampersand.each
it's
a
really
nice
way
of.
If
the
subscriptions
were
null
and
I
called
it
dot
each
it's
going
to
say
I
can't
iterate
on
a
null.
It
should
have
been
an
empty
array.
I
don't
know
what
to
do.
I'm
going
to
error
out
center,
etc,
ampersand's,
basically
saying
if
it
exists
and
each
so
it's
a
nice
little
trick.
Just
so
you
don't
have
to
add
a
function
and
you
know
add
a
call
there.
A
That's,
like
you
know,
return
blah
if
subscriptions
null
no
like
should
say
so.
It's
a
nice
little
trick
that
I've
picked
up
along
the
way
from
there.
I've
got
kind
of
a
redundant
line
here
that
says,
skip
it.
If
the
subscription
status
isn't
active.
The
reason
that's
redundant
is,
I
already
said,
only
pull
ones
where
it's
active,
but
you
know
it's
there.
I
I
don't
know
I'll
remove
it
at
some
point.
A
If
the
current
ending
is
nil,
we
just
want
to
skip
the
subscription,
because
that
basically
means
it's
an
invalid
in
date
that
something's
wrong
with
it.
We
don't
want
to
parse
that
if
the
date
parse
of
the
end
date
is
less
than
today,
that
means
they're
expired,
so
we're
going
to
go
ahead
and
just
skip
the
iteration.
A
Otherwise
we're
going
to
determine
plan
and
push
that
to
our
plans.
Array
up
here
and
all
determine
plans
is.
Is
we've
got
one
ultimate
two
premium,
three
starter
three
starter,
and
this
is
basically
just
doing
a
little
regex
on
the
name
of
the
plan,
so
ultimate
becomes
ultimate
premium
becomes
premium,
starter,
starter
and
basic
is
also
starter.
A
The
numeric
values
will
come
into
play
up
here.
We've
also
got
eight
custom,
that's
just
an
else
statement.
Basically,
if
it
didn't
match
any
of
these,
just
call
it
custom.
It's
gonna
look
way.
You
know
that
way.
We
know
something's
up,
but
basically,
if
the
plans
are
greater
than
one
meaning,
we've
added
something
other
than
this
nine
expired
we're
going
to
delete
expired.
A
That
means
they
have
some
kind
of
plan
from
there
we're
going
to
do
a
sort
and
map,
and
this
right
here
this
one
dot
dot
negative
one
is
a
really
fancy
way
of
saying
yeah.
Give
me
the
string
minus
the
first
character,
so
basically
ultimate
or
one
ultimate
becomes
ultimate
to
premium
becomes
premium,
and
I'm
calling
unique
that's
if
they
have
like
five
silver
subscriptions.
We
obviously
don't
want
silver
silver
service
over.
We
just
want
one
silver,
because
yeah
be
beyond
that.
A
I
say
I
want
the
minimum
plan
and
that's
one:
that's
why
these
have
these
numbers
just
for
sake
of
sorting
of
one
two,
three,
eight
nine,
if
you're
wondering
why
it
skips
from
three
to
eight
to
nine
global,
has
more
plans
and
had
to
account
for
things
like
community
and
silver
and
bronze
and
gold.
A
A
So
beyond
that
we
got
this
verified
data
which,
in
our
case,
just
checks
for
duplicates.
That's
the
only
thing
we
actually
have
to
check,
for
we
can
sync
the
rest
of
it
just
as
is,
and
all
that's
going
to
do
is
duplicates
up
here.
I've
got
this
fancy.
I've
got
this
where
duplicates
is
equal
to
determine.
A
Okay,
so
all
I'm
doing
is
taking
the
data
and
I'm
grouping
it
by
the
name
and
I'm
down
casing
it,
because
zendesk
cares
about
names
regardless
of
case,
so
we
want
all
the
names
in
down
case,
so
we
can
compare
them
and
I
just
want
the
values.
What
this
is
basically
going
to
do
is
give
me
a
whole
bunch
of
account
objects,
that's
what
it's
going
to
do
it,
but
it's
going
to
group
them
in
arrays
based
on
their
name
and
then
from
there.
A
So
we
just
remove
them
and
report
on
them
from
there.
You
know
we've
got
a
report
which
will
tell
us
hey,
I
located
this
many
here's
the
duplicates
and
then
we'll
also
iterate
and
tell
us
each
of
the
names
of
the
duplicates
and
it's
going
to
create
our
salesforce
accounts
and
sftc
account
problems,
json
artifact
files.
A
Right
on
so,
the
other
gather
script
for
salesforce
is
contacts.
You'll
see
this
looks
a
lot
like
the
other
one
our
run
gathers
and
generates,
and
it
reports
a
lot
of
this
is
really
the
same.
We've
got,
you
know
determining
duplicates.
The
only
addition
here
is
the
missing
values,
because
if
they're
missing
an
email
or
a
name,
we
obviously
can't
sync
them.
We
don't
yeah.
Those
are
required
fields
a
desk,
but
it's
basically
just
going
to
do
the
same
thing.
Here's
our
soql
query,
you'll
notice,
the
where
statement
pretty.
A
Exact
same
with
the
addition
of,
if
it's
an
inactive
contact,
we
don't
want
that.
So
this
is
kind
of
a
weird
statement,
but
an
active
content
is
false,
which
would
make
them
an
active
content.
Contact.
Sorry,
hey
jason!
I'm
sorry!
When
you
asked
for
questions,
I
hadn't
seen
that
artie
had
posted
something
in
chat.
Are
you
meant
vocalizing
for
the
recording.
B
Oh
yeah,
no,
I
think
jason
kind
of
answered
this
question
when
he
was
talking
through
it
already,
but
it's
just
to
do
with
the
way
that
the
plan
is
set
like
for
the
tagging
for
the
different
plans,
and
I
assume
that
the
reason
why
there's
only
the
three
plans
like
ultimate
premium
and
starters,
because
this
is
u.s
fed
and
then
global-
has
all
of
them.
A
Correct
yeah
global
also
has
a
bronze
silver
gold
community,
so
it
does
have
a
couple.
Others
that's
why
it
goes
from
one
two
three
to
eight
like
it's
literally,
because
this
is
kind
of
a
mirror
copy
of
what
we
have
in
global,
which
I
I
think
does
like
one
ultimate,
two
gold,
three
premium,
four
silver,
something
like
that.
I
don't
remember
the
exact
numerical,
the
exact
order
of
it
but
yeah
it
has
like
community.
I
think
it
has
like
edu
oss.
It
has
a
couple
different
plans
that
we
have
to
account
for.
A
Cool
yeah,
so
you'll
notice
the
contact
sync,
the
contact
gathers
pretty
much
the
exact
same
thing
other
than
we're
gathering
contacts
instead
of
organizations.
A
Our
contact
object
is
considerably
simpler,
because
all
we
really
need
to
know
is
game,
email,
org
and
we're
going
to
use
the
salesforce
id
just
for
sake
of
data
checking
later
so
it's
there,
but
you'll
notice
here,
like
if
the
names
nil
or
the
name
is
blank
or
the
email
is
no
or
the
email
is
blank.
It's
basically
adding
these
to
a
missing
array
that
way
it
can
kind
of
subtract
them.
A
A
Cool,
so
that's
the
salesforce
portion
of
the
sync
script,
the
zendesk
function,
the
zendesk
portion
yeah,
it's
going
to
look
kind
of
like
the
salesforce
function.
You
know
salesforce
stuff
to
begin
with,
it's
going
to
call
gather.
It
also
has
sync
which
we'll
go
over
in
a
bit:
we'll
focus
on
gather.
A
Okay,
cool,
so
organizations,
you
know
sales,
zendesk,
salesforce,
sync,
us
federal
class,
zendesk
class
gather
class
organization
inherit
from
client.
That's
just
so.
We
can
call
the
requests
really
quickly
without
having
to
type
out
a
ton
of
space.
What
this
does
is
just
generate.
A
The
artifact
and
report
probably
could
have
made
a
function
called
gather,
or
you
know,
probably
could
have
put
like
a
gather
function
here,
but
I
just
didn't
for
this:
one
data
is
gather,
orgs
gather,
words
is
going
to
basically
say
I'm
gathering
the
organizations
it's
going
to
set
an
empty
array
have
next
page
set
to
one
and
we're
going
to
do
what
might
be
like
nails
on
a
chalkboard
to
some
programmers,
but
basically
I'm
going
to
iterate
over
pagination
using
faraday
requests.
A
I
have
not
found
a
better
way
to
do
this
in
zendesk,
yet
I
always
look
forward
to
finding
a
better
way,
but
right
now
the
most
they'll
return
is
100
results
page.
So
the
second
you're
over
a
hundred
organizations
surprised
we
are
for
every
instance,
you're
gonna
have
to
start
doing
page
nation.
So
basically
this
is
going
to
print
a
dot
for
each
page.
This
is
just
so
when
I
review
scripts.
A
I
can
see
how
many
you
know
pages
it
had
to
go
through
it's
going
to
make
her
get
requests
to
organizations
json
setting
the
page
to
whatever
next
page
is
so
start
with
one
it'll.
Add
the
organizations
to
our
orgs
array
up
here.
It's
going
to
make
sure
to
map
them
into
org
objects.
We'll
go
over
that
in
a
second.
A
If
the
next
page
is
blank
in
the
response
like
it
doesn't
have
a
value.
That
means
we're
done
paginating
we
can
just
break
out
of
it.
Otherwise
we
need
to
add
one
and
go
to
the
next
page
after
that
it
puts
out
done
and
returns
the
organizations,
so
the
org
object,
you'll
notice.
This
looks
a
lot
like
what
salesforce
had
that's,
because
we're
going
to
compare
them
in
the
compare
script,
so
it
helps
to
have
them
look
almost
the
exact
same.
A
We
also
make
sure
to
check
the
support
level
and
determine
the
subscription
so
for
support
level.
Basically,
I'm
just
checking
to
if
it
says
it's
basic.
I
want
to
say
it's
starter,
because
basic's,
an
old
term,
we
don't
use
that
starter
is
the
correct
term.
Otherwise,
just
return
the
support
level
that
it
has
invest
for
the
subscriptions.
A
I've
got
an
allowed
the
one
for
global
way
longer,
because
it
has
a
lot
more
different
things
to
check
for,
but
in
the
case
of
in
the
case
of
the
us
federal,
we
got
starter
premium
ultimate
community
and
custom
and
community
actually
doesn't
belong
there.
So
I
mean
it
doesn't
hurt
that
it's
there,
but
there's
no.
A
In
federal,
but
basically
we're
going
to
duplicate
the
tags
by
just
using
org
tags
dupe
or
dup.
However,
you
want
to
pronounce
that
I've
always
pronounced
it
dupe
since
it
stands
for
duplicate
and
then
we're
gonna
set
that
to
subscriptions
and
then
we're
going
to
only
select
from
the
tags,
the
ones
in
this
and
these
select
allowed
tags
these
plans,
if
it
didn't
find
any
it's
gonna
return
expired
because
they
don't
have
any
plan
tags.
That
means
they're
expired
and
then
it's
gonna
return
subscriptions.
A
If
you
know
it's
gotten
that
far,
what
this
is
going
to
do
is
basically
duplicate
all
that
subscription
checking
we
did
in
the
salesforce
stuff
and
then
clean
tags.
This
is
literally
just
cleaning
up
the
tags
so
that
we
don't
have
a
bunch
of
duplicates
and
we
don't
have
the
starter.
You
know
we
don't
have
these
plan
tags
in
there,
since
those
will
be
added
in
later,
but
that's
pretty
much
all
there
is
to
gathering
zendesk
organizations
and
surprise
users
is
kind
of
the
same
stuff.
A
There
we
go,
you
know,
gathering
users,
it's
gonna
page
eight
over
the
only
difference
here
is
we're
using
the
user's
endpoint
I'm,
including.
A
A
A
I
only
want
end
users
like
we
don't
need
to
sync
users,
or
you
know,
agents
and
then
page
next
page.
It's
kind.
B
A
Doing
the
same
stuff
we
saw
before
you
know
we're
taking
the
user
object,
we
want
the!
U
and
we
want
all
the
organizations
passed
in
each
user
object
function.
This
is
so
we
can
easily
cross
reference
them
and
it'll
do
that
until
the
pages
there
are
no
more
pages
and
then
return
the
users,
so
the
user
objects
we're
going
to
detect
from
the
orgs
where
the
user.
A
You
know
the
organization
id
equals
the
user's
organization,
id
that'll,
give
us
the
org
and
then
down
here
we
can
call
you
know
if
the
org
is
nil,
just
make
it
empty
they're
not
associated,
it's
not
gonna
happen
very
often,
since
they
would
have
to
be
associated
to
have
been
detected
anyway,
but
you
know,
and
then
the
org
name
will
be
returned
if
it
exists.
Salesforce
id
is
kind
of
the
same
thing
of
like.
If
there's
not
a
no
an
org,
it's
gonna
be
blank.
A
A
Cool,
so
we
have
our
modules
and
salesforce
sync
us
federal.
That's
the
last
time
I'm
going
to
read
that
entire
thing
out.
A
So
we're
setting
some
variables
here,
just
for
sake
of
referencing
them
later
it's
good
for
creating
the
artifacts,
it's
good
for
doing
quick
counts,
but
our
actual
compare
is
going
to
determine
our
sync
needs.
It's
going
to
go
over
each
of
the
accounts,
which
are
defined
way
down
here,
should
have
put
that
at
the
top.
But
that's
basically
the
salesforce
accounts
from
our
previous
artifact
file
and
it's
going
to
go
over
each
with
index.
A
Each
index
is
useful
for
basically
just
printing
out
this
nice
pretty
formatted
string.
So
we
can
see
what
count
it
is
on.
That's
really
not
needed
other
than
that,
but
I
like
it
so
yeah,
but
all
this
prep
format
doing
is
it'll
print
out
a
count
of
what
account
number
it's
on,
so
that
we
can
quickly
when
we're
running
the
script.
See
like.
Oh
I'm
on
five
of
five
thousand.
I'm
on
two
thousand
eight
hundred
of
ninety
two
thousand-
it's
nice
to
see
how
long
it's
running
it's
nice
to
see
where
it's
at.
A
A
But
beyond
that
we're
going
to
look
in
the
organizations
which
again
don't
find
down
here,
but
it's
the
zendesk
organizations
and
we're
doing
a
detect
to
look
for
a
matching
sales
force
id
since
that
value
is
only
going
to
be
present
in
one
organization
or
should
only
be
present
in
one
organization.
A
That's
a
good
thing
to
look
for
if
it's
not
in
zendesk,
which
would
mean
that
zd
is
nil.
We
know
that
we
need
to
create
an
organization,
so
we're
going
to
push
it
to
creates
using
create
objects.
A
Otherwise,
we
need
to
determine
if
updates
are
needed,
which
is
you
know,
we
got
a
and
zd
the
account
in
the
zendesk
object
and
then
we'll
print
done
if
you're
not
familiar
with
backslash
r,
it's
returned
so
it
puts
the
cursor
all
the
way
back
to
the
beginning
of
the
line
which
is
useful
when
I'm
printing
out
this
stuff
and
just
overwriting
numbers
and
stuff
like
that.
A
So
we'll
look
at
the
create
object,
real
quick!
This
is
a
create
objects.
You'll
notice.
This
looks
different
than
the
objects
we
had
in
previous
scripts.
That's
because
this
is
specifically
what
zendesk
wants
it
to
look
like
when
you
pass
it
to
it.
It's
for
a
created,
a
non-existent
org.
It
wants
a
name.
A
Organization
fields,
which
are
our
custom
fields
that
we've
made
into
zendesk-
and
you
know,
salesforce
id,
sfdc,
short
id
support,
level,
arr,
market
segment,
etc,
etc,
etc,
and
then
tags
we're
basically
getting
the
subscriptions
and
just
sorting
them.
That's
it
because
the
rest
of
these,
like
market
segment
or
support
level
or
account
type,
those
are
drop,
downs
they'll,
add
their
own
tags
automatically
to
zendesk.
So
we
don't
actually
have
to
worry
about
that.
A
Now
the
determine
update
function,
that's
what
we
got
here.
We've
got
a
comparable
object,
which
is
a
very
fancy
way
of
saying.
I
don't
need
to
compare
an
id
or
the
tags.
Those
are
custom
only
to
zendesk.
I
do
not
need
to
compare
those
to
salesforce,
it's
making
sure
to
sort
the
subscriptions
and
make
sure
the
health
score
is
in
string
format.
This
is
just
to
make
sure
that
when
it
compares,
it
doesn't
feel
like
well,
it
said
premium
ultimate
starter,
but
zinda
said
starter
premium
ultimate.
A
But
yeah,
so
basically,
it's
just
going
to
duplicate
the
organic
organ.
Remove
those
pretty
up
the
objects
so
that
we
can
actually
compare
it,
which
is
as
equal
as
easy,
as
is
the
account
equal
to
the
zendesk
object.
Are
they
the
same
thing?
Well,
if
they
are,
then
we're
going
to
push
it
to
do
nothing
just
for
sake
of
counting
and
reporting,
otherwise
we're
going
to
push
the
update
object,
which
looks
very
similar
to
the
create
object
other
than
it
has
an
id
beyond
that.
You
know,
update
tag
list
which
you
can
see
here.
A
All
that's
doing
is
making
sure
to
add
the
subscriptions,
making
sure
to
sort
them
and
unique
them
and
then
pass
them
back.
Then
we
generate
the
file
report.
Is
you
know,
words
create
sync
and
good
standing?
That's
where
do
nothing
comes
into
play?
It's
just.
This
is
how
many
orgs
are
good,
not
necessary.
I
like
it,
though
just
so
I
can
quickly
look
and
make
sure
the
sync
is
working,
it's
good
to
see
the
sync
run
and
then
on
the
next
run,
see
that
number
go
up
like
we
want
to
see
the
do.
A
Nothing
count.
Go
up
and
up
and
up
yeah,
so
the
other
compare
is
the
users.
A
Cool
so
syncs
our
last
portion
of
this,
which
is
basically
us
taking
that
creates
and
those
updates
files
and
passing
them
to
zendesk
to
actually
do
it.
We
have
these
nice
little
objects
here
that
create
updated
errors.
They're
just
nice
placeholders,
while
we
add
stuff
to
them
creates,
is
here.
I
think
I
probably
define
them
at
the
bottom
yeah
I
need
to
stop
doing
that,
but
creates
is
the
creates
file
updates.
The
updates
file
for
the
creates
I'm
going
to
do
each
with
index.
A
That's
just
for
sake
of
reporting,
create
org
is
just
going
to
call
create
a
post
request
to
the
organizations
using
create
objects,
which
I
then
take
the
object
we
had
before
and
really
says
to
really
put
it
into
the
object
that
zendesk
wants,
because
they
want
it
in
the
format
of
organization
and
then
all
your
fields
and
then
organization
fields,
and
all
that
I
do
it
this
way,
because
zendesk
has
occasionally
changed
how
they
want
those
objects
to
look,
and
it
is
really
annoying
to
have
to
figure
out
what
to
have
to
go
back
to
compare
and
then
go
back
to
other
another
another
another.
A
After
that,
the
you
know
we'll
create
the
org,
the
sync
orgs,
which
I
should
probably
rename
to
update
words.
It's
badly
named
we're
doing
something
a
little
different,
you'll
notice,
I'm
doing
it
each
slice
100..
A
That's
really
fancy
way
of
saying,
take
my
giant
array
and
make
it
into
smaller
arrays
that
are
that
have
a
size
of
100.,
basically
from
there
we're
going
to
map
them
into
update
objects,
which
you
can
see
up
here,
we're
then
going
to
take
the
requests
and
put
them.
You
know
and
you'll
notice
that
the
actual
sync
object
I'm
using
is
organizations
and
then
a
bunch
of
these
update
objects
and
it's
putting
that
to
json
and
sending
it
to
the
update
mini.
A
The
reason
for
this
is
if
we
have
to
update
100
orgs,
doesn't
sound
like
a
lot,
but
it
takes
100
api
requests.
Update
mini
takes
one.
It
creates
a
job
which
we'll
have
the
job
status
for,
and
the
job
process
is
way
quicker
than
the
api.
Does.
I
don't
know
why
it
just
does
we
don't
do
that
for
creates
solely
because
I've
not
seen
a
case
where
I
had
to
create
more
than
like
10
use.
10
works
as
long
as
the
script
stays
update
and
everything's
good
to
go.
A
It
really
doesn't
have
that
situation
and
then,
at
the
end,
you
know
it's
going
to
report.
Here's
what
I
created.
Here's
what
I
say
if
there
were
any
errors
during
these
scripts,
which
you
can
kind
of
see
here,
there's
the
handle
error
during
the
create
org.
If
there
was
a
response,
error,
it'll
print
out
all
the
various
errors
which
most
the
time
is
name
blah
already
exists,
I've
never
seen
it
send
out
anything
else,
because
our
sync
script
has
so
much
data
checking
in
it
that
it's
prevented
every
other
possible
error.
A
But
I've
absolutely
seen
name
already
exists
and
that's
normally
when
ops
has
to
go
investigate.
What's
going
on
and
the
create
use.
You
know
the
sync
users
is
the
exact
same
thing:
it's
just
using
specifically
the
user
create
the
user,
create
many
and
all
that
fun
stuff.
A
There's
not
a
whole
lot
of
difference
on
this
one.
Either,
like
you
can
see
how
it's
still
doing
each
slice,
it's
doing
a
user's
update.
Many,
the
only
difference
is
these
objects
are
way
smaller
and
a
lot
easier
to
manage.
A
A
Cool
looks
like
we're
in
a
good
place,
so
yeah,
that's
the
basics
of
the
zendesk
sales
force,
u.s
federal,
sink,
which
I
said
it
again
so
I
lied
earlier.
I
guess
I
had
to
say
it
one
more
time,
but
that's
the
basics
of
it,
the
code
it
lives
in
the
ops
instance.
That's
because
the
pipelines
they
they're
gonna
show
customer
data
it's
private
and
protected.
A
We
can't
have
that
available
to
everybody,
so
unfortunately
we
have
to
have
any
private
instance,
but
we
do
have
our
training
and
our
documentation
all
that
fun
stuff.
That
is
publicly
available
for
you
to
look
at
this
video
as
well.
You
can
always
feel
free
to
come
in
to
support
ops
and
ask
us
questions.
You
can
always
feel
free
to
schedule
a
coffee
chat
with
me
if
you
want
to
go
over
it
or
understand
or
if
you
have
ideas
to
improve
it.