Expectation on ID in CreateUser

Hi,

I tried to follow the schema to use CreateUser mutation. But I have trouble with the syntax and expected arguments. So I want to create a new user in a WFG directory. I have graphQL code like this:

mutation {
createUser(input: {

userName: "test1234", 
lastName: "User", 
firstName: "Test", 
directoryId: 1}

)
}

By running that, my graphQL code becomes:
mutation {
createUser(input: {

userName: "test1234", 
lastName: "User", 
firstName: "Test", 
directoryId: 1}

) {
clientMutationId
}
}

And I got the error saying The ID is invalid
{
“errors”: [
{
“message”: “The ID is invalid.”,
“locations”: [
{
“line”: 2,
“column”: 3
}
],
“path”: [
“createUser”
]
}
],
“data”: {
“createUser”: null
}
}

When I am about to add a new user, am I supposed to define an ID? I was hoping WFG will create that automatically

Hi Kevin,

The directoryId stated is invalid.

You can retrieve the Directory ID using GraphQL

{
  directory(name: "workflowgen") {
    id
  }
}

result should be something ike this:

{
  "data": {
    "directory": {
      "id": "RGlyZWN0b3J5OjE="
    }
  }

In Graphql ALL the IDs are global IDs and not internal IDs. Use GraphQL queries to retrieve them.

Hi Eddy,

I can query the direct id with separate graphQL query. But how can I apply the found directory id in my mutation createUser as directoryId?

Hi Kevin,

Either by running two queries like you mentioned. Or just store the ID in a variable, the directory ID does not change in time.

Regards,
Eddy.