►
From YouTube: Support Ops - Zendesk - ZD-SFDC Sync v4
Description
Jason Colyer, Support Operations Manager, takes us through how the ZD-SFDC sync works
A
A
So
this
is
the
zendesk
salesforce
sync
mechanism.
It
varies
a
little
bit
between
us
federal
and
partner
sync,
but
generally
speaking,
they
all
run
kind
of
the
same
scripts
with
few
tweaks
for
the
environment,
they're
syncing
themselves
at
its
core.
It
runs
through
this
gitlab
ci
file
and
what
it
is
we
have
these
stages
where
we're
gonna
gather
the
data,
compare
it
and
then
sync,
it
we're
caching
them
into
ruby
path,
just
to
kind
of
help.
It
run
a
little
quicker.
A
The
before
script
is
going
to
get
the
ruby
version
for
debug
reasons,
install
bundler
and
then
run
bundle
on
it,
which
will
use
the
gem
file
to
install
the
required
gems
and
libraries,
the
actual
stage
jobs
themselves
for
the
gather
stage.
We
have
the
precinct
zd
org
report
and
the
precinct
sf
org
report.
A
What
these
are
essentially
doing
is
running
a
gather
script
for
both
things
and
creating
artifacts.
That
expire
in
four
hours.
A
For
the
compare
we're
running
the
precinct,
org
comparison
report,
which
is
going
to
require
those
past
two
jobs,
succeeded
and
then
it's
going
to
run
using
you
know,
run
using
the
compare
script
and
generate
two
artifacts
that
creates
and
updates
json
files.
The
final
stage,
sync
stage
runs
the
sync
organizations
and
that's
going
to
sync:
the
actual
organizations
requiring
that
comparison.
Job
had
succeeded.
A
A
A
So
the
client
file
is
going
to
require
the
compare,
salesforce
and
zendesk
scripts.
It's
going
to
set
a
function
for
the
retry
options.
This
is
to
be
used
with
faraday
so
that
we,
if
there's
a
timeout
it
tries
again.
If
there's
a
connection
failed,
it
will
try
again.
This
is
so
that
we
try
to
prevent
failures
based
on
timeouts.
A
Beyond
that
we
have
the
salesforce
object.
This
is
using
restforce
to
generate
a
connection
to
salesforce.
We
have
the
zendesk
object,
which
is
using
faraday
to
create
a
new
connection
to
the
zendesk
url,
and
it's
for
the
config.
It's
going
to
pass
the
retry
options.
The
adapters
faraday
defaults,
the
headers
are
the
application
json
for
the
content
type
and
the
basic
authentication
is
the
zendesk
username,
slash
token
and
the
token
itself,
and
then
we
have
the
request
function,
which
is
going
to
take
an
http
method,
a
url
and
parameters.
A
A
So,
let's
go
back
to
here
and
let's
start
with
the
hey:
let's
start
with
zendesk,
the
zendesk
file
itself
is
just
going
to
require
the
gather
and
the
sync
functions.
A
So
the
gather
script,
it's
going
to
you
know
call
the
modules,
invest
sales
for
sync
main:
it's
going
to
call
this
class
zendesk
and
then
make
the
class
gather
and
it's
inheriting
from
clients.
This
is
so
we
don't
have
to
redefine
the
client
to
the
faraday
connection
and
all
these
other
things
and
it's
got
the
run
function
which
is
just
going
to
generate
an
artifact
and
report.
A
We
have
the
data
function,
which
is
going
to
set
a
global
variable
of
data
and
set
it
to
the
value
of
gather
orgs.
If
it
doesn't
have
value
already
gather
orgs,
it's
going
to
print
that
it's
gathering
orgs,
it's
going
to
start
on
page
one,
and
it's
going
to
make
zendesk
requests
for
every
page
through
the
organizations
to
gather
all
of
them
and
put
them
into
this
orgs
array.
A
A
The
organization
object
is
where
a
lot
of
this
comes
into
play,
where
it's
defining
the
id,
the
name,
the
tags
salesforce
id
all
these
other
functions.
All
these
other
organization
fields
that
we
need
and
then
determine
subscriptions,
is
basically
just
taking
the
tags
and
looking
for
starter
premium,
ultimate
bronze
silver
gold
and
then
adding
them
to
an
array
to
a
string
that
is
separated
by
a
space
that'll
be
used
later
in
the
comparison
to
actually
check
the
tag
to
make
sure
everything's
in
a
good
place.
A
A
Now
gather
is
just
going
to
run
the
data
function
and
then
verify
the
data,
the
data
function,
being
that
it's
going
to
run
a
salesforce
query
and
map
those
to
an
account.
Object,
duplicates
we're
setting
this.
This
global
variable
duplicates
and
we're
using
the
determined
duplicates
function
to
check
it
for
verified
data.
All
we're
doing
is
subtracting
the
duplicates
from
the
data
data
global
that
global
variable
and
then
saying
we're
done
with
that,
because
that's
the
only
thing
we
really
need
to
check.
A
That's
the
only
thing
that
will
actually
prevent
a
sync
generated:
artifacts
is
going
to
generate
using
the
data
and
duplicates
variables
to
generate
salesforce.json.
Salesforceproblems.Json
report
is
just
going
to
tell
us
yeah
here's
how
many
accounts
I
located
here's
the
number
of
duplicates
and
it's
going
to
print
out
the
duplicates
so
that
we
can
act
on
that.
If
we
need
to
the
query,
string
is
just
a
long
string
that
we
that
we're
sending
to
salesforce
to
do
a
quirk.
A
A
A
The
reason
for
this
is
just
to
make
it
in
formatting
zendesk
to
understand
so
like
if
it's
prospect
it's
going
to
return
an
empty
space.
It's
going
to
return
an
empty
string,
prospect
ce
user,
empty
string.
Otherwise
it's
going
to
take
the
support
level
from
salesforce
and
just
down
case
it
for
us
for
priority
support.
It's
going
to
return
false
if
it's
a
customer
former
customer,
because
we
don't
do
priority
support
for
existing
customers,
they
already
have
priority
support
by
being
your
customer,
but
otherwise
it's
going
to
return.
The
manual
support
upgrade
value
from
salesforce.
A
Now
subscriptions
is
a
bit
different.
We've
got
this
subs
array
that
we're
starting
with,
and
basically
it's
using
all
these
salesforce
objects
to
determine.
Do
they
have
multiple
subscriptions
and
then
joining
us
into
a
string
that
is,
you
know,
separated
by
a
space,
the
region,
if
it's
nil,
it's
gonna
turn
into
string,
but
otherwise
it's
going
to
give
us
the
down
case
of
the
region
but
prepending
it
with
org
region
and
then
determine
duplicates.
A
Now,
beyond
that,
we
have
the
comparison
script.
So
let's
look
at
that
pardon
me.
We
have,
of
course,
the
modules
index
salesforce,
sync
main,
and
then
the
class
compare
its
run
function
is
going
to
compare
generate
artifacts
and
report.
We
create
some
variables
here
that
we
can
use,
create,
updates
and
do
nothing.
These
are
mainly
for
reporting
and
for
generating
the
artifacts
now
for
comparing
them
we're
going
to
go
through
each
with
the
index
and
what
we're
going
to
do
is
print
out
the
format
in
a
way
that
it's
showing
a
counter.
A
As
it
goes,
it's
going
to
find
the
zendesk
organization
based
using
the
salesforce
data,
it's
going
to
find
that
object
in
zinda
and
zendesk
data.
If
it
doesn't
exist,
it's
going
to
push
it
to
the
create
saying,
hey.
I
need
to
make
this.
Otherwise
it's
going
to
run,
determine
update
on
both
of
them,
and
then
it'll
say
it's
done
now.
Determine
update
is
going
to
make
a
comparable
object
from
the
actual
organization
we
got
from
zendesk.
A
This
is
so
we
can
compare
them
because
the
zendesk
object
is
going
to
have
like
the
zendesk
id
right,
but
salesforce
won't
have
that.
So
we
need
to
make
sure
we
remove
that
make
the
tags
in
a
format.
We
can
compare
stuff
like
that
now
beyond
that
we're
going
to
compare
them.
If
they're
the
exact
same,
you
don't
have
to
do
nothing
push
it
to
that
object.
Call
it
done.
If
we
do,
we
need
to
push
to
the
updates
object
using
you
know
an
update
object
now.
A
The
comparable
object
which
you
saw
run
up
above
here
is
literally
just
going
to
duplicate
the
organization,
delete
the
id
delete,
the
tags
make
sure
the
subscriptions
are
split
and
sorted
and
joined,
and
then
we're
going
to
make
the
health
score
go
to
s,
because
sometimes
it's
nil,
but
we
want
it
to
be
an
empty
string.
If
that's
the
case
now
create
an
update,
object
are
basically
just
the
objects
we're
going
to
pass
to
zendesk.
So
we
can
skip
past
those
update
tags
list.
A
It's
going
to
take
the
tags,
duplicate
it
and
then
add
any
of
the
accounts
that
are
there
and
then
it's
going
to
do
a
sort
and
unique.
We
want
them
sorted
by
alphabetical
and
any
that
are
duplicates
we
want
to
remove
the
generate.
Artifacts
is
going
to
create
a
creates.json
and
updates.json
which
we'll
use
in
the
sync
itself,
and
then
it's
going
to
create
a
report,
letting
us
know
here's
how
many
creators,
I
need
to
say,
here's
how
many
ingredients
standing
and
organizations
and
accounts
are
just
used
by
using
these
artifact
files
from
previous
jobs.
A
A
The
run
is
going
to
do
created,
updated
errors,
create
orgs,
sync
orgs
report
created
is
just
creating
this
object
with
zero,
so
we
can
count
how
many
we've
created
updated
same
thing
and
errors
is
an
array
where
we
can
store
any
errors
now
for
creating
the
orgs.
What
it's
going
to
do
is
attempt
to
create
the
org,
and
it's
going
to
do
this
by
making
a
zendesk
request
to
the
organization's
json
endpoint
it's
going
to
make
a
post
request,
so
we
can
do
the
create
itself.
A
If
there's
an
error,
it's
going
to
put
it
in
error,
it's
going
to
call
the
handle
error
function,
we'll
go
over
that
a
bit.
Otherwise
it's
going
to
it's
going
to
add
one
to
the
created,
so
we
know
it
was
creating
correctly
now.
The
actual
sync
object
which
we
use
for
the
updates
looks
like
this.
This
is
the
exact
formats
that
zendesk
wants
it
and,
at
the
end,
we're
calling
this
to
json.
Just
so
it's
json
object.
We
can
throw
it
in
real,
easy
for
syncing
the
orgs.
A
We
have
the
updates
and
it's
kind
of
the
same
thing
as
creates
we're
going
to
go
through
each
one
and
run
the
update
org,
which
will
make
a
put
request
to
the
organization
itself.
If
there's
an
error,
it
will
handle
error.
Otherwise,
it's
going
to
count
when
updated
for
report.
It's
going
to
tell
us
how
many
created,
how
many
it's
synced
and
if
there
are
any
errors,
it's
going
to
tell
us
what
the
errors
are
and
the
airport
is
literally
just
going
to
go
through
that
errors,
array
and
output
out
one.
A
You
know
what
the
error
is
and
handleair
is
just
going
to
take
the
response
and
push
the
actual
respond.
The
error
string
of
the
response
to
it.
The
error
string,
is
going
to
take
that
salesforce
id
and
say
it
could
not
be
synced.
Here's
why
and
then
creates
and
updates
is
just
the
creates
and
updates
artifact
files.
We
got
from
the
past
job.
A
So
beyond
that
we
have
the
ci
cd.
Let
me
go
ahead
and
quickly
go
over
this.
Let's
go
through
schedules
right
now.
We
have
it
inactive
as
we're
pushing
it
update,
but
traditionally
what
this
would
do
is
it's
gonna
run.
It's
gonna
run.
You
know
every
hour
at
the
bottom
of
the
hour,
utc
time
again,
normally
it's
active,
but
we
have
it
inactive
as
we're
pushing
it
update
to
it
at
the
moment.
A
That's
all
there
is
to
how
the
zendesk
salesforce
sync
script
works.
As
I
said,
the
us
federal
one,
the
partners
one
and
this
one
all
are
slightly
different
in,
like
the
query
they're
running
or
what
they're
thinking
exactly
so
it
is
best
to
review
the
scripts
and
kind
of
get
a
handle
for
them.
But
beyond
you
know
generally,
what
you've
seen
here
is
how
they
run.