How to get Inactive Users via api call from outside sugar.

Hi,
I am trying to find a user in sugar via user_name field and that user is inactive. While making api call via postman i am not getting that inactive user detail.


http://<localhost>/rest/v11/Users/?filter[0][user_name]=Test

Is there any param available for getting the inactive user via api call or do i need to make some customization in sugar to get that user.

Thanks

  • You might need a custom API if you want to access inactive users, since sugar filters out Inactive users in the API by default.

    Use this documentation to know how to create Custom APIs - https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Integration/Web_Services/REST_API/Extending_Endpoints/

    May I know why you need inactive user info? If the API doesn't return anything, you can assume they don't have access to Sugar.

  • I need to sync records to sugar from other system. and that system may have some records assigned to inactive user. That system provides user_name as assignment identity. So first i need to fetch that user from sugar via that username and then do assignment.
    As username can be of inactive user so i am not able to get the id of that user via default get api call.
    So thats why i was asking is there any default way to achieve that. Or i need to write custom api.

  • Interesting, thanks for the explanation -

    You may have to write a custom API to search by Inactive users, since Sugar filters them out by default. Follow this link on how to create custom APIs - and you can write your custom logic to return the Inactive user IDs.

    But - there are a couple of other options you could explore:

    1. Make the user active, migrate the data, and then make the user inactive again. If you want to disable login, you can just set a random password in user_hash and force sugar_login as true.

    2. Get all the list of users upfront from the DB (or from the Admin UI), cache them and use the IDs directly in your migrate script.

  • Well, Thanks for the answer i appreciate. Slight smile

    I have to go with the custom API approach. 

    Have a Good Day. 

  • If other system provides the name of a person not listed in active users by name it means this user is not allowed to use Sugar anymore.
    What is the purpose to get the Sugar internal id of such a person?
    Do assignments to other eligible Sugar users, using the name as identifier (if you search id by name, that means it is identifier too)

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • That is client's requirement, that user is expected to be set to active in future.

  • Client has to buy licenses first and activate users.

    Until that, there is Employees ledger that  represent not only eligible users (employee record is created automatically for new user) but other staff too, whether they are retired users, possible future users or staff that nothing to do with CRM either. Employees could be retrieved with API  , that may help to link external accounts to future users until they receive legal rights to use Sugar and sugar data could be assigned to them 

    I hope this makes sense

    All the best,

    Dmytro

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • Thanks for the idea, this is also possible to keep the employee status active and User inactive and then get the id of that user via employees api.
    This could be a workaround. Slight smile
    Thanks that's really helpful.