Hi,
We are trying to insert data in table using script for which we need to generate UID as well as XObjectKey. I tried searching for OOTB system scripts if we can reuse it and generate UID but could not find it. Can you please help? Thank you.
Hi,
We are trying to insert data in table using script for which we need to generate UID as well as XObjectKey. I tried searching for OOTB system scripts if we can reuse it and generate UID but could not find it. Can you please help? Thank you.
The object layer auto-generates these values for you.
It was throwing an error when I was trying to insert the data in table via script
You need to post the error message and your code if you want the community to help you out.
You need to post the error message and your code if you want the community to help you out.
Hi Markus,
Here is the code
Public Function testscript() As String
Dim ConnectionString As String = Connection.GetSingleProperty("DialogDatabase", "ConnectionString", "")
Dim con As New SqlConnection
con.ConnectionString = ConnectionString
Dim Querypeset As String = "Insert Into Eset (Ident_Eset,DisplayName,Description) Values('ABC','ABC','description')"
Dim cmdpeset As New SqlCommand(Querypeset, con)
con.Open()
cmdpeset.ExecuteNonQuery()
con.Close
Return "done"
End Function
and the error message
Exception has been thrown by the target of an invocation.
Cannot insert the value NULL into column 'UID_ESet', table 'IDSVCDB.dbo.ESet'; column does not allow nulls. INSERT fails.
The statement has been terminated.
This one is obvoious. You are not using the OneIM object layer. You are using the raw SQL queries. This is not a best practice.
Thanks, George. I totally agree.
I can see VID_PutValueSafe in OOTB script. Can you suggest if I can use that to insert data in tables?
Our official YouTube channel has complete video series about programming (or scripting) against the OneIM object layer / API.
https://www.youtube.com/playlist?list=PL242czeZwlAk0T2AcqpSFtBOXQfkP9f5J
ok I will check this. Thank you so much for your support.