Ad Group synchronization error

Hi all

I have to run a synchronization involving AD Groups and AccProduct table. In details, once a given group is read from AD, I need to find a Product in the AccProduct Table with Ident_AccProduct equals to SamAccountName of the group.

This procedure is pretty simple and it works fine against hundreds of groups except when in the following case: the Group’s SamAccountName is something like xxxxxx$MISERVER$xxxx.

The query I implemented to get the AccProduct is as following:

 Dim AccProdObjectResult = SystemObject.Connection.QueryObject(SystemQuery _
   .From("AccProduct") _
   .Select("CustomProperty01","UID_AccProduct") _
   .Filter("Ident_AccProduct = '" &  cstr(AccProd) & "'" )
   ).Result

 

where AccProd is equal to xxxxxx$MISERVER$xxxx.

the exception message is " Error loading system objects of class AccProduct (all) (AccProduct_Master)."

I’m afraid this error is related to the $----$ chars into the SamAccountName

I've also tried something like 

 Dim AccProdObjectResult = SystemObject.Connection.QueryObject(SystemQuery _
   .From("AccProduct") _
   .Select("CustomProperty01","UID_AccProduct") _
   .Filter("Ident_AccProduct = '" & cstr(AccProd) & "'" )
   ).Result
 

and like 

  Dim AccProdObjectResult = SystemObject.Connection.QueryObject( SystemQuery _     .From("AccProduct") _     .Select("CustomProperty01","UID_AccProduct") _     .Filter(String.Format("Ident_AccProduct = '{0}'",cstr(AccProd) ))     ).Result

 

but nothing changes.

Please can someone advices me about how to solve this issue?

Parents Reply Children
  • Hi Markus

    That’s interesting solution but I’m afraid I cannot rely on it neither.

    Unfortunately, the relation between the SamAccountName and the Ident_AccProduct is something like

    SamAccountName = xxx_Indet_AccProduct_yyy

    I think I cannot instruct the KRP to match that pattern. If I’m wrong, please advice.

    Is there a way to execute e “plain SQL query”, it this way excluding the connector? I mean, can I write something like Something.SomethingElse.ExecuteQuery(“select UID_AccProduct from … where… ”) ?

    Alberto

  • No you cannot write plain SQL. By the way, wouldn't work if you are connected via an application server.

    The $..$ thing just seem to be a problem in the query object so why should SAMAccountName = xxx_Ident_AccProduct_yyy be an issue if you are not using it in an SystemQuery.

  • Markus
    let's say the samaccountname I need to match is xxxxx$MiServer$yyyy and the ident_AccProduct stored on the db  is cccc_xxxxx$MiServer$yyyy_dddd, where cccc and dddd are constant strings.
    In the code I submitted, the value cccc_xxxxx$MiServer$yyyy_dddd is stored in the variable AccProd and it is correctly formatted.
    I know I cannot write plain SQL… I meant if there is a way to pass "hand written - old fashion query" to the connector or to some other objects, in order to prevent the connector (or any other object) from writing or modifying the query itself.
    Alberto 
  • Did you try something like

    Dim AccProdObjectResult = SystemObject.Connection.QueryObject(SystemQuery _
    .From("AccProduct") _
    .Select("CustomProperty01", "UID_AccProduct") _
    .Filter(SystemObject.Connection.FilterFormatter.Comparison(SystemObject.SchemaType("Ident_AccProduct"), CStr(AccProd), Filter.Formatter.FilterCompareOperator.Equal))
    ).Result

    or is this showing the same error?

  • Hi Markus

    it seems promising but unfortunately the table on which I’m working is AdsGroup, not AccProduct, so the code "SystemObject.Connection.FilterFormatter.Comparison(SystemObject.SchemaType("Ident_AccProduct")… " fails.

    The exception (given 574 times) is 

    "The property (Ident_AccProduct) does not exist in schema type (Active Directory groups (ADSGroup))"

    Is there a way to “point” the system object to the AccProduct table?

     

    Alberto

  • You are right, forgot about that.

    Again, I'll try to find a workaround for you. You should contact support in addition.

    But as a workaround, you could take my approach and refine it a little bit.

    1. You create virtual property to build your AccProduct string (cccc_xxxxx$MiServer$yyyy_dddd) vrtAccProduct based on the SAMAccountName
    2. You fetch the UID_AccProduct using another Key resolution property (name it for example vrtUID_AccProduct). The Key Resolution property searches for the vrtAccProduct created in step 1.
    3. If you need the UID_AccProduct elsewhere, you can reference it in the rest of your script.
  • Next attempt:

    Dim AccProdObjectResult = SystemObject.Connection.QueryObject(SystemQuery _
    .From("AccProduct")
    .Select("CustomProperty01", "UID_AccProduct")
    .Filter(SystemObject.Connection.FilterFormatter.Comparison(SystemObject.Connection.Schema.Types("AccProduct").Properties("Ident_AccProduct"), CStr(AccProd), Filter.Formatter.FilterCompareOperator.Equal))

    ).Result
  • Hi Markus

    I’ve followed your advice:

    • I created the vrt property “vrt_AccProduct_Ident_AccProduct” as “Format Defined Property”. I assigned the value ccccc_%SAMAccountName%_ddddd

    From my log, it seems it works like a charm. I copy the string generated into SQL client , I run the query and I get all the AccProduct, so I’m sure the string is perfectly created and match exactly the Ident_AccProduct

    • I created the vrt property “vrt_AccProduct_UID_AccProduct” as “Key resolution” as follows:
      1. Base Property: vrt_AccProduct_Ident_AccProduct
      2. Schema type for resolving: AccProduct
      3. Search property: Ident_AccProduct
      4. Result property: UID_AccProduct

    I did not add any property mapping rules (maybe I’m missing something here)

    During the synch process, I print both the variables vrt_AccProduct_Ident_AccProduct (always right) and the vrt_AccProduct_UID_AccProduct, but the last one has NEVER a value. Is there an order by which the variables are evaluated by the synch process?

    What I’m a doing wrong? Please… advice if you have any idea.

     Anyway, I opened a case.

    Alberto

  • Hi Alberto,

    if you are in contact with support ask if a fix for VPR#31964 is available.

    We enhanced the filter object to allow you to specify if variables are part of your filter definition or not.

    So, in your case, your code snippet would look like as follows (notice the , false in the .Filter definition).

    Dim AccProdObjectResult = SystemObject.Connection.QueryObject(SystemQuery _
    .From("AccProduct") _
    .Select("CustomProperty01","UID_AccProduct") _
    .Filter("Ident_AccProduct = '" & cstr(AccProd) & "'", false )
    ).Result