rikas / zoho_hub

Zoho CRM API V2 Wrapper
MIT License
25 stars 30 forks source link

Get Blueprint Transitions #44

Closed nwittstruck closed 4 years ago

nwittstruck commented 4 years ago

Hey, it seems there is only support to Put blueprint transitions, but not to Get them. How do you currently get the possible transitions?

The Zoho API supports to retrieve all possible transitions for an object using a Get request on the blueprint transition endpoint. Unless I'm missing something and there is interest in this, I could provide a PR.

What do you think?

Fabien-Wecasa commented 4 years ago

Here is a comment from my code for a Lead, if it can help (probably not the optimal way, but I need to do that only once):

    # To get a Blueprint transition id:
    # Find a lead with the transition allowed, get its Zoho ID. Then in a console:
    #
    #   con = ZohoHub.connection
    #   response = con.get("https://www.zohoapis.com/crm/v2/Leads/<LEAD_ZOHO_ID>/actions/blueprint")
    #   transition = response[:blueprint][:transitions].find { |t| t[:next_field_value] == "Appointment" }
    #   transition[:id] # => "20242070000xxxxxxx"
    #
    # TODO: get the transtion id dynamically (part of it must be done in the zoho_hub gem)

As you can see, your request is in my TODO, but I don't have time at the moment. So if you can help, it will be appreciated !