API to create/update user with custom lookup field on user | Community
Skip to main content

API to create/update user with custom lookup field on user

  • October 18, 2023
  • 3 replies
  • 0 views

Yingmo

Hi,

I have a custom field 'doctor' on user object, the doctor refers to another user, it is a lookup field. I'm trying to create/udpate user object through create/update API.

The payload is something like this: 
{

     user: {

       name: 'xxx',

       user_fields: {

              doctor: 13456678 // The doctor id in zendesk.

        }

     }

}

I have problems with this. If I create a user for the first time, I can create the user, but doctor field is empty when I check the Web console. I manually change the doctor to someone in the Web GUI, then call create_or_update API, the doctor will be changed to the one I wanted.

I can also reproduce this issue:  when I manually change the doctor to empty in Web, it will also fail to update the doctor.

Did anybody have this issue before?

3 replies

Tipene
  • November 9, 2023
Hey Yingmo,
 
Are you still running in to issues here? If so, let me know and I'll be happy to help out!
 
Tipene

Yingmo
  • Author
  • November 10, 2023

Thanks for your help @tipene, yes, I still have the problem. When the doctor field is empty, I cannot update it. I can update it when I set it to any other value manually in dashboard.


Tipene
  • November 17, 2023
I've just tried to replicate this on my end but it is working as expected. Can you try doing this in postman to see if the user_field is being returned at all in the response body? And just to be sure, none of the filters you have set in the custom field would preclude the id from being set, right?