cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
906
Views
0
Helpful
9
Replies

Updating user with Org Units using NSAPI

CPSC.User
Level 1
Level 1

We have a requirement where we need to update users with different Organizational Units using an external system. The integration guide lists an NSAPI that might be used for this operation, Create/Update Person. This just says that we need to use the XML received from a Get person details API and use it as a request XML.

The problem we are facing is figuring out where to place the new Org Unit details in the request XML.Would anyone know about that detail.

Is this even the correct API for achieving the requirement or are we looking at the wrong thing here

 

1 Accepted Solution

Accepted Solutions

Thanks, that makes the requirements a bit more clear.

If you are to pull from the external system rather than pushing to CPSC then I think using the SDK mentioned above might be better suited as this is mostly what it was designed for, however this is probably a little more complex to implement than the REST API.

If you are still going the route of using the REST API, based on what I've seen and read this API ignores the associatedOrganizationalUnits which is where you update the OU membership, so I cannot see another way for you to do this through the current REST API.

A potential third option is to create a service within CPSC that updates a user using the built-in directory tasks in the plan, this service can then be consumed through the Requisition API, the downside to this is that there will be a requisition generated for each and every update.

 

View solution in original post

9 Replies 9

Paul Jeffrey
Level 1
Level 1

Could you possibly explain your scenario and flow a bit more?

Are you creating new users, allocating users to new OU(s) or both?

Also, would you be pushing updates to CPSC or could CPSC pull the new information from the external system when users log onto the system?

CPSC has a directory integration SDK that ties into what's know as the Person Lookup and Import events, this allows you to run custom java code to query an external system and update a user profile with everything from individual user attributes to Role and OU memberships, I suspect that this might be more suited to your scenario from what I understand of it so far.

For more information on this you can review to to the Using Custom Code in Directory Integration section in the Integration Guide.

The requirement doesnt involve creating new users or OUs. Existing users need to be added to existing OUs using some external application.

I've been able to acheive that in a way using the nsapi mentioned above(Create/Update Person),I've been able to add users to OUs but that results in changing the Home OU of the user as thats the field I change in the response from a Get Person details API to add that user to the OU.

Though, I can change back the HomeOU to the original value by doing another Create/Update person API for the original OU.

Hope this makes the requirement clear. Do you have a better alternative for completing this requirement?

Thanks, that makes the requirements a bit more clear.

If you are to pull from the external system rather than pushing to CPSC then I think using the SDK mentioned above might be better suited as this is mostly what it was designed for, however this is probably a little more complex to implement than the REST API.

If you are still going the route of using the REST API, based on what I've seen and read this API ignores the associatedOrganizationalUnits which is where you update the OU membership, so I cannot see another way for you to do this through the current REST API.

A potential third option is to create a service within CPSC that updates a user using the built-in directory tasks in the plan, this service can then be consumed through the Requisition API, the downside to this is that there will be a requisition generated for each and every update.

 

Paul, the third option appears to be the easiest, but the fields for Organizations, Groups and Roles need to be multi select and include all the orgs/groups/roles that the user is already part of, otherwise the ones that are not there in the fields are removed from that users list after the directory task for updating person is performed.

Strangely, the RAPI is not able to populate fields that require multiple values. Even if I remove that entire field or even pass just a single value, the response is still the same:

<errorCode>REQ_0034</errorCode>
               <errorMessage>The values for this Field: 'DictName.FieldName' has data more than designed values.</errorMessage>

It works correctly when I change that field to text and pass a single value, is there some other way that we need to pass data for a multi select field?

 

Hi

I believe the RAPI should still support multi-value fields,what input type are you using when configuring it as multi-value?

Perhaps you could share an example of the Web Service call to look at?

 

EDIT:

I tried a quick example in our environment to update roles and all seems to work fine, the field was of type select (multiple) and used a SQL query to populate the Option List with all possible roles.

 

The XML for the field values looked something like this:

 

<req:Field>

 <req:Name>Roles</req:Name>

 <req:Value>

   <req:string>Role 1</req:string> <!-- Roles need to exist in option list -->

   <req:string>Role 2</req:string>

 </req:Value>

</req:Field>

Hi,

I've changed the input type to select(multiple) for that field and it works fine when I order it from the portal directly. Its able to set multiple values into the field when an sql query return more than one row.

The problem only occurs when I use the RAPI for making a request to that service.

The structure I use for passing data to that field is:

                   <req:Field>
                         <req:name>FieldName</req:name>
                           <req:value>                             
                              <req:string>Value1</req:string>
                              <req:string>Value2</req:string>
                           </req:value>
                    </req:Field>

which is what you've pasted above.

Even if I stop sending any value to this field and only send values to other single value fields, it still gives the same error message.

Odd, sounds like everything is setup correctly.

Could you confirm the version and patch level of CPSC?

The only other thing I could think of is permissions or access rights, are you using an admin account to trigger of the request through the RAPI?

 

Another option is to maybe share a few screenshots of the configuration for your SQL statement and general configuration options for the Active Form Component and Dictionary as well as the full RAPI request XML to see if there is anything I can spot.

Ok, let me try and get that info.

Dont think its a permission issue because I can trigger a request when I change it to a single value field.

Have you been able successfully make a request to such a service using RAPI from your test environmnt?

OK, well will check when I get the info then.

 

I did do test a full example in my environment and all worked properly for me.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: