RSS

Error while deploying SmartObjects to different environments

20 Apr

I keep seeing this error pop up in projects so I’ll add it here as a gotcha. Basically you have a fully working project which has been completely tested, and then just when you’re confident that all is working you deploy to the live environment and boom – you get this error:

Error 1 Deploy SmartObjects: Task error: SmartObject Server Exception: Dependancy could not be created: System.Exception: Dependancy could not be created. Parent does not exist in this environment.

This really is no big deal. To understand the error though, you have to understand the relationship between service objects and SmartObjects. SmartObjects can’t exist on their own – they need a service object to live on top of (consume, if you’re going to get picky). When you call a SmartObject method, the SmartObject calls a method in the underlying service object and it’s the service object which interfaces between the K2 world and the real world. You get some inkling of this relationship when you create the SmartObject in the first place – you registered your service object and then created the SmartObject on top of it.

What isn’t immediately obvious is the fact that the link between the SmartObject and the service object is a GUID, not the name of the service object. This GUID is assigned to the service object when you register it, so when you registered your service object on the live server it was assigned a new GUID, so when you tried to deploy the SmartObject the service object it needs (i.e. the parent) isn’t there.

Generally when you deploy a service object for the first time you want to make careful note of the GUID it’s assigned, and include that GUID in your deployment documentation (yes – you SHOULD be writing deployment documents!). Now when you register your service object on a new K2 server, don’t use the default GUID – you should copy and paste the GUID from your deployment document. Now when you deploy your SmartObject it will no longer be an orphan.

 
4 Comments

Posted by on April 20, 2011 in Service brokers, SmartObjects

 

4 Responses to Error while deploying SmartObjects to different environments

  1. V

    August 27, 2013 at 6:42 pm

    How do you specify a GUID for a Service Object though? I see no field for it…

     
  2. Trent Jacobs

    August 29, 2013 at 3:28 am

    Good question. It depends on where you are creating your service objects. In most cases though you’ll see a GUID text field when you create it.

    You should be able to get to the GUIDs using the SmartObject testing tool.

     
    • V

      December 11, 2013 at 7:19 pm

      Let’s say I create the Service Instance in the SharePoint K2 Site Settings > SmartObject Management area? I am not prompted for GUID in this case.

       
  3. Joel

    November 18, 2015 at 2:54 pm

    For anyone else who may see this – In the Package and Deployment manager, when you deploy, right click your service instance -> (Make sure it’s included) Use existing service instance.

    This will pick up the service instance on the server you are deploying on, and should now deploy.

     

Leave a Reply

Your email address will not be published. Required fields are marked *