How to set an UNSAccountB as Outstanding by using a VB Script (XmarkedForDeletion = 2)
How to set an UNSAccountB as Outstanding by using a VB Script (XmarkedForDeletion = 2)
Hi René,
you have to set the state property of the entity your UNSAccountB is stored in your script code.
Please take a look at the sample script that loads an UNSAccountB object from the database, sets it to Outstanding and saves it to the database.
Public Sub CCC_UNSAccountB_MarkAsOutstanding(UID_UNSAccountB As String)
Dim eUNSAccountB As IEntity
' Create and load the UNSAccountB entity
eUNSAccountB = Session.Source.Get("UNSAccountB ", UID_UNSAccountB)
' Set the state of the entity to OutStanding
eUNSAccountB.State = eUNSAccountB.State Or EntityState.OutStanding
' Save the entity to the database
Using uow = Session.StartUnitOfWork()
' put the entity to save in the unit of work
uow.Put(eUNSAccountB)
' The entities will be saved here!
uow.Commit()
End Using
End Sub
HtH
Hi Markus
Thanks this has worked for me. Now I have changed the input value to XObjectKey so tjhat I am able to use the function for groups and assignments too.
Public Sub CCC_Util_MarkAsOutstanding(XObjectKey As String)
Dim OKey As New DbObjectKey(XObjectKey)
Dim e As IEntity
e = Session.Source.Get(OKey)
e.State = VI.DB.Entities.EntityState.OutStanding
Using uow = Session.StartUnitOfWork()
uow.Put(e)
uow.Commit()
End Using
End Sub