Skip to main content

Dear K2 community,

I have a problem while saving a new record in the editable list item. It throws an error

 

"SmartObject property ID is a required property for selected method Create. Value must be set."

 

1. I created a table in SQL Server database with fields

ID

Company

Department

Account

Amount

 

2. I created a smartobject and editable list item view. When I created a view initially I did not add ID (key) first and thought it might because of this, I am getting an error and I could not able to save.

 

3. Next, I created anyther view with ID but still getting the same error - "SmartObject property ID is a required property for selected method Create. Value must be set."

 

Since I have already worked on the rules in the views and also in the form, its extra work if I design this editablelistitem view from scratch, I would like to know how can this issue be resolved. Looking for your valuable suggestion. Thank you.

Hello IPO,


 


This is a really common error that can occur under a lot of different situations.  I am going to assume that you are using K2 Designer in a fairly current version and that Sharepoint is not involved.


 


In Designer if you create the list view directly from the smart object (right click on the smart object, then design view), it will "write" the configuration rules for you as long as you select the right things in setup.  I have attached some screen shots for how to do this.


 


If this does not solve it then test the get list method on your smart object (using the smart object testing tool) and see what columns it is returning.  If there isn't an ID column there is probably an issue with your SQL table.


 


Good luck,


H46Hoya


 


 


Thank you for your response.

 

I used K2 designer for creating views and smartform. I completely started from scratch as you mentioned, new database table and then created a smartobject and run the service tester tool to check for the methods execution for create,list and everything seems fine.

 

table

ID int

Company nchar(10)

Department nchar(10)

Amount Decimal(18,2)

 

Then in the Smartobject properties, I changed the ID to autonumber.

 

Then I created a view and tried to add a new list item and upon save, I still get the same error. Here are the details error- Null reference expcetion.

 

  • Type:
    System.NullReferenceException
  • Source:
    SourceCode.SmartObjects.Client
  • Method Base
    • Member Type:
      Method
    • Name:
      Validate
    • Module
      • Scope Name:
        SourceCode.SmartObjects.Client.dll
    • Declaring Type
      • Full Name:
        SourceCode.SmartObjects.Client.SmartObject
  • Stack Trace:

    at SourceCode.SmartObjects.Client.SmartObject.Validate(Boolean isList)

    at SourceCode.SmartObjects.Client.SmartObjectClientServer.ExecuteScalar(SmartObject smartObject, DataTable inputTable)

    at SourceCode.Forms.AppFramework.FormRuntime.SmartObjectExecution(XPathNavigator nav, Boolean outputDependencies, SmartObjectClientServer svr)

    at SourceCode.Forms.AppFramework.FormRuntime.WorkXmlToApi(String xml)

    at SourceCode.Forms.Runtime.AJAXCall.ProcessRequest(HttpContext context)

well,

These are my findings

 

1. I did some some test in creating a smartobject in the K2 Designer itself (it creates a SmartObject inside the K2 database table unlike User created database table).Then, I created a list view and add a new row and save it. It worked perfectly fine. All Create,Delete,Edit, Save works fine.

 

2. Then I tried to do the same by creating a table in the different database (not in K2Database), created a smartobject, and view. Add a new row and save it, it thows same error.

 

I didnot understand now, where I went wrong ? Please help.

Thank you.


Reply