This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Update property in Department table

I would like to update CustomProperty03 for Department where FullPath = 'PZ'. I've prepared the script:

Public Function HRS_Department_Update() As String

    Dim dbDepartment As IEntity = Nothing
    Dim f As ISqlFormatter = Connection.SqlFormatter
    Dim result As String = "NOK"
	
	If Session.Source.TryGet( Query.From("Department").Where(f.Comparison("FullPath", "PZ", ValType.String, , CompareOperator.Equal, FormatterOptions.NonUnicodeLiterals)).SelectNonLobs, dbDepartment ) Then
		dbDepartment.PutValue("CustomProperty03", "Test")
		result = "OK"
    End If
	
	Using uow As IUnitOfWork = Session.StartUnitOfWork()
        uow.Put(dbDepartment)
        uow.Commit()
    End Using
	
	Return result
End Function


Function returns "OK" but CustomProperty03 is empty.

Parents
  • As the code look correct, I assume that you are having a template on Department.CustomProperty03 that is changing the value.

    Easiest way to debug, is to turn on the Debug log level in the Operations log in Object Browser and to test your script in the Object Browser. Then, take a look at the logger named ObjectLog.

     

Reply
  • As the code look correct, I assume that you are having a template on Department.CustomProperty03 that is changing the value.

    Easiest way to debug, is to turn on the Debug log level in the Operations log in Object Browser and to test your script in the Object Browser. Then, take a look at the logger named ObjectLog.

     

Children
No Data