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

Insert Record in PersonWantsOrg

I had this working once, but have not been able to figure out why it fails now...

 

the following code snippet:

Dim pBag As New PropertyBag
pBag.PutValue("UID_PersonOrdered",strUIDPerson)
pBag.PutValue("UID_PersonInserted",strUIDPerson)
pBag.PutValue("UID_Org",strUIDITShopOrg)
pBag.PutValue("OrderReason", "PAAS Request")
pBag.PutValue("CustomProperty01", strRequestID)
pBag.PutValue("OrderState","New")
pBag.PutValue("OrderDetail1", strRequestDetails)
pBag.PutValue("CustomProperty05", strServiceAccountID)
pBag.PutValue("CustomProperty06", strRequiresApproval)

' Don't set empty values
If Not String.IsNullOrEmpty(strApprovalDetails) Then
pBag.PutValue("CustomProperty07", strApprovalDetails)
End If
If Not String.IsNullOrEmpty(strRequestDetailsEncrypted) Then
pBag.PutValue("CCC_OrderDetails3", strRequestDetailsEncrypted)
End If

'For Group Update Actions, we need to append the action to the request type.
If Not String.IsNullOrWhiteSpace(strRequestTypeAction) Then
If (Not logFile.Equals("1")) Then
VID_Write2Log(logFile,"Adding -" & strRequestTypeAction & " to " & strRequestType)
End If
strRequestType = strRequestType & "-" & strRequestTypeAction
If (Not logFile.Equals("1")) Then
VID_Write2Log(logFile,"Request Type Now Set to " & strRequestType)
End If
End If
pBag.PutValue("CustomProperty02", strRequestType)
If (Not logFile.Equals("1")) Then
VID_WRite2Log(logFile,"***PropertyBag For PWO for RequestID: " & strRequestID)
VID_Write2Log(logFile,"***UID_PersonOrdered " & pbag.GetValue("UID_PersonOrdered").ToString())
VID_WRite2Log(logFile,"***UID_PersonInserted: " & pbag.GetValue("UID_PersonInserted").ToString())
VID_WRite2Log(logFile,"***UID_Org: " & pbag.GetValue("UID_Org").ToString())
VID_Write2Log(logFile,"***OrderState: " & pbag.GetValue("OrderState").ToString())
VID_WRite2Log(logFile,"***OrderReason: " & pbag.GetValue("OrderReason").ToString())
VID_WRite2Log(logFile,"***CustomProperty01: " & pbag.GetValue("CustomProperty01").ToString())
VID_WRite2Log(logFile,"***CustomProperty02: " & pbag.GetValue("CustomProperty02").ToString())
VID_WRite2Log(logFile,"***OrderDetail1: " & pbag.GetValue("OrderDetail1").ToString())
VID_WRite2Log(logFile,"***CustomProperty05: " & pbag.GetValue("CustomProperty05").ToString())
VID_WRite2Log(logFile,"***CustomProperty06: " & pbag.GetValue("CustomProperty06").ToString())
If Not String.IsNullOrEmpty(strRequestDetailsEncrypted) Then
VID_WRite2Log(logFile,"***CCC_OrderDetails3: " & pbag.GetValue("CCC_OrderDetails3").ToString())
End If
If Not String.IsNullOrEmpty(strApprovalDetails) Then
VID_WRite2Log(logFile,"***CustomProperty07: " & pbag.GetValue("CustomProperty07").ToString())
End If
VID_WRite2Log(logFile,"***Writing PropertyBag to PWO for RequestID: " & strRequestID)
End If
' Insert into PersonWantsOrg and Get the UID
Dim dbPWO As ISingleDbObject = Connection.CreateSingle("PersonWantsOrg")
Dim Results = dbPWO.Custom.CallMethod("FillOrder",pBag)

If (Not logFile.Equals("1")) Then
VID_Write2Log(logFile,"FillOrder Results: " & Results.ToString())
End If

uidPersonWantsOrg = dbPWO.GetValue("UID_PersonWantsOrg").ToString()
dbPwo.Save
dbPwo.Discard()

 

I get the following output:

 

4. Create Property Bag for PWO
***PropertyBag For PWO for RequestID: 1f2eb4f0-9662-4761-b702-1ccfe73053e0
***UID_PersonOrdered 07101905-e7eb-4e51-8c26-bd11d1530034
***UID_PersonInserted: 07101905-e7eb-4e51-8c26-bd11d1530034
***UID_Org: 7BA08A4C-3616-4748-8662-EB1BB9BCCFBE
***OrderState: New
***OrderReason: PAAS Request
***CustomProperty01: 1f2eb4f0-9662-4761-b702-1ccfe73053e0
***CustomProperty02: AD-User-Create-Service-Keytab
***OrderDetail1: {"User":{"DomainName":"ADServer","SamAccountName":"DUMMY1","Path":"zlab.test/Users","DisplayName":"MyDisplayName","Description":"Service Account Test Creation","Owner":"MyOwner","Enabled":"true","KeytabCrypto":"24","KeytabPrincipalName":"MyKeytabPrincipalName","KeytabFileName":"fdp00-12345-hbase.service.keytab","CanonicalName":"MyCanonicalName","EmployeeType":"SERVICE","PrincipalName":"UserPrincipalName","PasswordNeverExpires":"True","CannotChangePassword":"True","AuthType":"Keytab","SPN":null,"GroupCategory":null}}
***CustomProperty05: fa5cccfc-233f-e711-80e3-ac162d9f9c7b
***CustomProperty06: False
***CCC_OrderDetails3: {"User":{"DomainName":"ADServer","SamAccountName":"DUMMY1","Path":"zlab.test/Users","DisplayName":"MyDisplayName","Description":"Service Account Test Creation","Owner":"MyOwner","Enabled":"true","KeytabCrypto":"24","KeytabPrincipalName":"MyKeytabPrincipalName","KeytabFileName":"fdp00-12345-hbase.service.keytab","CanonicalName":"MyCanonicalName","EmployeeType":"SERVICE","PrincipalName":"UserPrincipalName","PasswordNeverExpires":"True","CannotChangePassword":"True","AuthType":"Keytab","SPN":null,"GroupCategory":null}}
***Writing PropertyBag to PWO for RequestID: 1f2eb4f0-9662-4761-b702-1ccfe73053e0
Error Saving 1f2eb4f0-9662-4761-b702-1ccfe73053e0 to PWO:
Object reference not set to an instance of an object.
Skipped Record due to Processing Error for: 1f2eb4f0-9662-4761-b702-1ccfe73053e0

 

You can't run this through debugger since Fillorder can't be run internally...I am at a loss as to what the Object reference not set to an instance of an object is referring to.   This is a vanilla 7.1.1 installation with just the one schema extension on PWO (I was trying to use AdditionalData, but thought that might be a problem, so I added a field.).   Am I misisng a parameter that has to be set?

Parents
  • Hi Robert

    Instead of using ISingleDBObject, try using the new Session-API of v7. As an quick example:

    Dim dbPWO = Session.Source.CreateNew("PersonWantsOrg")
    Dim Bag As New PropertyBag()
         
    Bag.PutValue("UID_PersonOrdered", UID_Person)
          ..
          ..
    Bag.PutValue("OrderState", "Assigned")  
          
    dbPWO.CallMethod("FillOrder", Bag)
    dbPWO.Save(Session)

Reply
  • Hi Robert

    Instead of using ISingleDBObject, try using the new Session-API of v7. As an quick example:

    Dim dbPWO = Session.Source.CreateNew("PersonWantsOrg")
    Dim Bag As New PropertyBag()
         
    Bag.PutValue("UID_PersonOrdered", UID_Person)
          ..
          ..
    Bag.PutValue("OrderState", "Assigned")  
          
    dbPWO.CallMethod("FillOrder", Bag)
    dbPWO.Save(Session)

Children
No Data