Not applicable

How to use a SQL SmartObject which has had changes made to its SQL table.

There could be a time when you have to add/delete a column or change a data type on a SQL Table that has a SmartObject associated with it. There are some steps that must be taken so that the views and forms referencing the SmartObject are not broken. All of this must be done from the SmartObject Service Tester.


 


#1: Get the GUID of the existing smartobject. Find the SmartObject in the SmartObject Explorer right click it and select View XML. The top line has both the SmartObject name and the SmartObject GUID. Copy this GUID, we will need it when we recreate the smartobject.


#2: Refresh the Service Instance for the database on which the table sits.


 


 


3821i1FE6832C7D32ECF1.png


 


 


 


 


#3: Find the SmartObject under the Service Instance, right click and select Create SmartObject.


#4. Input the GUID you copied in Step #1 into the GUID field. Publish the smartobject to overwrite the previous one and update it to the new topology.


 


 


3822iF20F854129B7DAC6.png

Reply
3 Replies
Andrew_Blinco
Apprentice

Re: How to use a SQL SmartObject which has had changes made to its SQL table.

Hi MTMTNT

 

Just be aware that if you regenerate the SmartObject from the SmartObject tester that you will lose any additional properties, methods and associations that you added after you first created the SmartObject  (e.g. you may have added a stored procedure as an additional method). K2 will recreate the SmartObject using only the Service Object properties and methods.

 

You can avoid this by refreshing the service instance (to update the service object) and then editing the SmartObject in either in Designer or K2 Studio. If you have added a new column to the table for example, you can the create the new property to match and update all of the methods to map to the new column.

Reply
Timkn
Contributor

Re: How to use a SQL SmartObject which has had changes made to its SQL table.

Thanks for that post.  I typically take a different approach. 

 

1.  Refresh the specific SQL Server service instance for the database the SmartObject is based on using the SmartObject Tester Tool.  This will let K2 know about any changes like adding/deleting a column or changing a datatype.

2.  Open the SmartObject and then then go through each method and either remove or add any additional properties from the SQL tables/Views/Stored Procedures.  Would need to do this with each method.

3.  Deploy or Save (if in K2 Designer) the SmartObject.

4.  Test out the changes using the SmartObject Tester tool.

 

I can see there would be pros and cons to both approaches and the approach you choose might depend on whether you manually created the SmartObject or relied on the Tester tool to do it for you.  I typically manually create the SmartObjects.

Reply
Nagorskiy
Apprentice

Re: How to use a SQL SmartObject which has had changes made to its SQL table.

Why you didnt use smartobject generate function from service tester?

0 Kudos
Reply