This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Variables in process integration do not work as expected

I'm building a process integration where I need to get the ID of a process field of type "user" and pass it to an integration (the Solar Winds API integration, but that doesn't really matter here).  The problem is, the variable resolves to the ID of the first group of the user, not the ID of the user itself.  While that is rather odd to be the default, it does sort of make sense when you look at the documentation here:
https://documentation.solarwinds.com/en/success_center/swsd/content/completeguidetoswsd/process_integration.htm, which indicates that {{user-var.id}} actually returns the group ID - which again, no idea why this is the default instead of the ACTUAL user id, since a user can have many groups.

The problem is, no matter WHAT I specify, I only get that first group ID of the associated user, and NOT the actual user ID.  Example:
I create a custom user field called "Employee" on a service request form.  The field type is "user", so you select a user in this field.
I make a new service request and select "Joe Black" as the user.  His user ID is 6019508.  He's a member of three groups, with ID's of 6433078, 7157601, 7413472, not that I care what groups he's in, I just want his ID.
I then make a call using process integration to api.samanage.com/.../{{Employee.user.id}}.
This call ends up going to https://api.samanage.com/users/6433078.
I can use {{Employee.id}} or just {{Employee}} or {{Employee.email}} or any other field that according to the aforementioned documentation is SUPPOSED to give me the respective attribute of the user object.  Instead, no matter what I use, I get 6433078, the user's first listed group ID.  I have no idea how that's even useful, or why in the world it's the default, but for the love, what do I gotta do to just get the ACTUAL ID of the user???

  • I should note, I'm using this same {{Employee}} field in the title of the service request that gets created, and that resolves to the employee name without issue.  So maybe there is a bug and this just doesn't resolve properly when a user field is used in the URL field of a process integration

  • Well, I think I have determined this is either a bug in SWSD or they just didn't ever build this functionality.  I created a separate service request with a simple process integration to add comments to the incident.  And then I put a bunch of variables and various incarnations of variable formats in the comment just so I could see what SWSD was resolving the variables to.  I found that my results match the documentation - {{user-var.id}} returns the first group ID of the user (which the logic on why that is is still a mystery to me), and {{user-var.user.id}} did indeed return 601958, the actual user ID of the user object.  So that leads me to believe that using this exact same variable in the URL field of the process integration is simply broken - it does not resolve like it is supposed to.  So that makes the following use case impossible:

    Let's say you want to update a custom field on a user object based on some condition or value in a service request.  Well, you can't.  You can't get the URL field to properly pull the User ID from your user field, and this is necessary to send a put request to the swsd api process integration.  You can only get the user's first listed group ID, which is of course useless.  You can get {{user-var.user.id}} to resolve in the BODY of your request, but not in the URL, which is how you specify which user you are updating. 

    So that is either a bug, their documentation is wrong (or at best incomplete), they somehow designed it intentionally this way (which would make no sense) or the process integration just isn't fully baked yet.  I'm going to look into getting a ticket open, see if I can find out what the deal is.

  • Hi , what you are trying to accomplish should be possible so I am not sure why its not working. Please open a ticket with our support team so we can let engineering take a look deeper into the issue. 

    Thanks!

  • Thanks for the reply.  I've submitted a ticket and it's been escalated.  I'll post here any results.

  • My associated support case on this was initially escalated, and then later determined that this should be "feature request."  I think it's clearly a bug, but I've submitted it as a feature request as advised.

    thwack.solarwinds.com/.../the-variable-evaluation-of-user-var-user-id-should-work-in-the-url-field-of-a-process-integration

  • I don't know when this was fixed but I just tested this today (3/5/2023) and it works now!  {{user-var.user.id}} now properly resolves to the actual user id, instead of the user's first listed group id.  In this example, "user-var" is whatever your variable is (your custom input field on your form) of type user.  So if your custom field was called "Employee" and was a field type of "user", you can now reference {{Employee.user.id}} in the URL field of a process integration and it resolves properly.