         createAndUpdate { provider, title, meta, stackTemplate }, callback
       else
         credential.update { meta, title }, (err) ->
-          callback err, stackTemplate
+          shareWithGroup credential, ->
+            callback err, stackTemplate
 
   else
     createAndUpdate { provider, title, meta, stackTemplate }, callback

  { credentials }    = stackTemplate
  credentials.custom = [credential.identifier]

  # After adding custom variable, we are sharing it with the current
  # group, so anyone in this group can reach these custom variables ~ GG
  { slug } = kd.singletons.groupsController.getCurrentGroup()

  credential.shareWith { target: slug }, (err) ->
    console.warn 'Failed to share credential:', err  if err

    stackTemplate.update { credentials }, (err) ->
      callback err, stackTemplate


kd     = require 'kd'
remote = require('app/remote').getInstance()

shareWithGroup = (credential, callback) ->

  # After adding custom variable, we are sharing it with the current
  # group, so anyone in this group can reach these custom variables ~ GG
  { slug } = kd.singletons.groupsController.getCurrentGroup()

  credential.shareWith { target: slug }, (err) ->
    console.warn 'Failed to share credential:', err  if err
    callback err


setStackTemplateCredential = (options, callback) ->
