Update Blueprint Details

Purpose

To update a single transition at a time. An error is thrown if the record is not in transition, transition_id is wrong, field_value data type mismatches, or field validation fails.

Request Details

Request URL

{api-domain}/crm/{version}/{module_api_name}/{record_id}/actions/blueprint

Supported modules

Leads, Accounts, Contacts, Deals, Campaigns, Tasks, Cases, Events, Calls, Solutions, Products, Vendors, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, Custom, Notes, and Activities

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}

Possible module names

leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, notes, and activities

Possible operation types

ALL - Full access to records
WRITE - Edit records in the module
UPDATE - Update records in the module

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2.1/Leads/3652397000003931001/actions/blueprint"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@blueprint1.json"
-X PUT
4.0.04.x
Copied//Get instance of BluePrintOperations Class that takes moduleAPIName and recordId as parameter
$bluePrintOperations = new BluePrintOperations($recordId,$moduleAPIName);
//Get instance of BodyWrapper Class that will contain the request body
$bodyWrapper = new BodyWrapper();
//List of BluePrint instances
$bluePrintList = array();
$bluePrintClass = 'com\zoho\crm\api\blueprint\BluePrint';
//Get instance of BluePrint Class
$bluePrint = new $bluePrintClass();
//Set transition_id to the BluePrint instance
$bluePrint->setTransitionId($transitionId);
//Get instance of Record Class
$data = new Record();
$lookup = array();
$lookup["Phone"] = "8940372937";
$lookup["id"] = "8940372937";
// $data->addKeyValue("Lookup_2", $lookup);
$data->addKeyValue("Phone", "8940372937");
$data->addKeyValue("Notes", "Updated via blueprint");
$attachments = array();
$attachment = array();
$fileIds = array();
array_push($fileIds, "blojtd2d13b5f044e4041a3315e0793fb21ef");
$attachment['$file_id'] = $fileIds;
array_push($attachments, $attachment);
$data->addKeyValue("Attachments", $attachments);
$checkLists = array();
$list = array();
$list["list 1"] = true;
array_push($checkLists, $list);
$list = array();
$list["list 2"] = true;
array_push($checkLists, $list);
$list = array();
$list["list 3"] =  true;
array_push($checkLists, $list);
$data->addKeyValue("CheckLists", $checkLists);
//Set data to the BluePrint instance
$bluePrint->setData($data);
//Add BluePrint instance to the list
array_push($bluePrintList, $bluePrint);
//Set the list to bluePrint in BodyWrapper instance
$bodyWrapper->setBlueprint($bluePrintList);
// var_dump($bodyWrapper);
//Call updateBluePrint method that takes BodyWrapper instance
$response = $bluePrintOperations->updateBlueprint($bodyWrapper);
Copied<?php
class UpdateBlueprintDetails{
    
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $curl_options[CURLOPT_URL] = "https://www.zohoapis.com/crm/v2.1/Leads/3524033000005811001/actions/blueprint";
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "PUT";
        $requestBody=array();
        $blueprint=array();
        $blueprintObject=array();
        $data=array();
        $widget=array();
        $widget["name"]="widget";
        $widget["id"]="3652397000003937009";
        $data["widget"]=$widget;
        $data["Phone"]=8940372937;
        $listings=array();
        $listingsObject=array();
        $interestedListings=array();
        $interestedListings["id"]="3652397000001978005";
        $listingsObject["Interested_Listings"]=$interestedListings;
        array_push($listings,$listingsObject);
        $listingsObject1=array();
        $interestedListings=array();
        $interestedListings["id"]="3652397000001978016";
        $listingsObject1["Interested_Listings"]=$interestedListings;
        array_push($listings,$listingsObject1);
        $data["Listings"]=$listings;
        $Attachments=array();
        $AttachmentsObject=array();
        $fileId=array();
        array_push($fileId,"59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d623a");
        array_push($fileId,"59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d624d");
        $AttachmentsObject["\$file_id"]=$fileId;
        array_push($Attachments,$AttachmentsObject);
        $AttachmentsObject1=array();
        $AttachmentsObject1["\$link_url"]="www.zoho.com";
        array_push($Attachments,$AttachmentsObject1);
        $data["Attachments"]=$Attachments;
        $data["Notes"]="Updated via blueprint";
        $MultiUserArray=array();
        $MultiUserObject=array();
        $MultiUser=array();
        $MultiUser["name"]="Shylaja Sridhar";
        $MultiUser["id"]="3652397000000186017";
        $MultiUserObject["Multi_user"]=$MultiUser;
        array_push($MultiUserArray,$MultiUserObject);
        $MultiUserObject1=array();
        $MultiUser=array();
        $MultiUser["id"]="3652397000000281001";
        $MultiUserObject1["Multi_user"]=$MultiUser;
        array_push($MultiUserArray,$MultiUserObject1);
        $data["Multi_user"]=$MultiUserArray;
        $blueprintObject["data"]=$data;
        $processInfo=array();
        $escalation=array();
        $escalation["days"]=1;
        $escalation["status"]="overdue";
        $processInfo["escalation"]=$escalation;
        $blueprintObject["process_info"]=$processInfo;
        $blueprintObject["transition_id"]="3652397000003921127";
        $transitions=array();
        $transitionsObject=array();
        $nextTransitions=array();
        $nextTransitionsObject=array();
        $nextTransitionsObject["name"]="Call Later";
        $nextTransitionsObject["id"]="3652397000003921103";
        $nextTransitionsObject["type"]="manual";
        array_push($nextTransitions,$nextTransitionsObject);
        $nextTransitionsObject1=array();
        $nextTransitionsObject1["name"]="Product Brief";
        $nextTransitionsObject1["id"]="3652397000003921135";
        $nextTransitionsObject1["type"]="manual";
        array_push($nextTransitions,$nextTransitionsObject1);
        $transitionsObject["next_transitions"]=$nextTransitions;
        $transitionsObject["type"]="manual";
        array_push($transitions,$transitionsObject);
        $blueprintObject["transitions"]=$transitions;
        array_push($blueprint,$blueprintObject);
        $requestBody["blueprint"]=$blueprint;
                
        var_dump(json_encode($requestBody));
        $curl_options[CURLOPT_POSTFIELDS]= json_encode($requestBody);
        
        $headersArray = array();
        
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " . "1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);      
    } 
}
(new UpdateBlueprintDetails())->execute();
2.1.0
Copied# Get instance of BluePrintOperations Class that takes module_api_name and record_id as parameter
bpo = BluePrint::BluePrintOperations.new(record_id, module_api_name)
# Get instance of BodyWrapper Class that will contain the request body
bw = BluePrint::BodyWrapper.new
# Get instance of BluePrint Class
blue_print = BluePrint::BluePrint.new
# Set transitionId to the BluePrint instance
blue_print.transition_id = transition_id
# Get instance of Record Class
data = Record::Record.new
data.add_key_value('Phone', '8940372937')
data.add_key_value('Notes', 'Updated via blueprint')
# Set data to the BluePrint instance
blue_print.data = data
# List to contain BluePrint instances
# Add BluePrint instance to the list
blue_print_list = [blue_print]
# Set the list to bluePrint in BodyWrapper instance
bw.blueprint = blue_print_list
# Call updateBluePrint method that takes BodyWrapper instance as parameter
response = bpo.update_blueprint(bw)
Copiedrequire 'net/http'
require 'json'

class UpdateBlueprintDetails

    def execute
        url = URI("https://www.zohoapis.com/crm/v2.1/Leads/3524033000005495065/actions/blueprint")
        req = Net::HTTP::Put.new(url.request_uri)
        http = Net::HTTP.new(url.host, url.port)
        http.use_ssl = true
        headers={}
        headers["Authorization"]="Zoho-oauthtoken 1000.dfa7XXXXXXXXXXXXXXXXXX84f9665840.c176aeXXXXXXXXXXXX13f3d37a84d"
        headers&.each { |key, value| req.add_field(key, value) }
        request_body = {};
        record_array = [];
        record_object = {};
        data_object={};
        record_object["transition_id"] = "3524033000000191089";
        data_object["Phone"]="8940372937";
        data_object["Notes"]="Updated via blueprint";
        record_object["data"] = data_object;
        record_array = [record_object];
        request_body["blueprint"] =record_array;
        
        request_json = request_body.to_json
        req.body = request_json.to_s
        response=http.request(req)
        status_code = response.code.to_i
        headers = response.each_header.to_h
        print status_code
        print headers
        unless response.body.nil?
            print  response.body
        end
    end
end

UpdateBlueprintDetails.new.execute
CopieddataMap = Map();
dataMap.put("Notes", "Updated via blueprint");
blueprint1 = Map();
blueprint1.put("transition_id", "692969000000981130");
blueprint1.put("data", dataMap);
blueprintList = List();
blueprintList.add(blueprint1);
param = Map();
param.put("blueprint", blueprintList);
	response = invokeurl
[
	url: "https://www.zohoapis.com/crm/v2.1/Leads/692969000000983046/actions/blueprint"
	type: PUT
	parameters: param.toString()
	connection:"crm_oauth_connection"
];
info response;

In the request, "@blueprint1.json" contains the sample input data.

Note
  • In the Related List sample, the key "Tasks" is the name of the list related to the record used in the transition.

  • The related list support for this API depends on the module of the record, which is used in the transition of the blueprint.

  • In case the number of fields in the input does not meet the required number, the "message" in the response would be "transition saved partially".

  • In a parallel transition, a transition can have multiple the parent transition gets completed automatically only when all its child transitions are completed. We will introduce this feature in the upcoming versions. Refer to this announcement for more details.

Sample Input

CopiedSample Input: To upload attachments, notes, input data to multi-select user lookup, multi-select lookup, and widget to the blueprint
{
    "blueprint": [
        {
            "transition_id": "3652397000003921127",
            "data": {
                "Attachments": [
                    {
                        "$file_id": [
                            "59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d623a",
                            "59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d624d"
                        ]
                    },
                    {
                        "$link_url": "www.zoho.com"
                    }
                ],
                "Phone": 8940372937,
                "Notes": "Updated via blueprint",
                "Listings": [
                    {
                        "Interested_Listings": {
                            "id": "3652397000001978005"
                        }
                    },
                    {
                        "Interested_Listings": {
                            "id": "3652397000001978016"
                        }
                    }
                ],
                "Multi_user": [
                    {
                        "Multi_user": {
                            "name": "Shylaja Sridhar",
                            "id": "3652397000000186017"
                        }
                    },
                    {
                        "Multi_user": {
                            "id": "3652397000000281001"
                        }
                    }
                ],
                "widget": {
                    "name": "widget",
                    "id": "3652397000003937009"
                }
            },
            "process_info": {
                "escalation": {
                    "days": 1,
                    "status": "overdue"
                }
            },
            "transitions": [
                {
                    "type": "manual",
                    "next_transitions": [
                        {
                            "name": "Call Later",
                            
                            "id": "3652397000003921103",
                            "type": "manual"
                        },
                        {
                            "name": "Product Brief",
                            
                            "id": "3652397000003921135",
                            "type": "manual"
                        }
                    ]
                }
            ]
        }
    ]
}

Sample Input: To handle parent module fields during transition
{
    "blueprint": [
       {
            "transition_id": "2000000031536",
            "data": {
                "Lookup_2": {
                    "phone": "123458939",
                    "id": "2000000048165"
                }
            }
        }
    ]
}

Sample Input: To update checklist information
{
    "blueprint": [
       {
            "transition_id": "1000000034304",
            "data": {
                "CheckLists": [
                   {
                        "list 1": true
                    },
                   {
                        "list 2": false
                    },
                   {
                        "list 3": true
                    },
                   {
                        "list 4": true
                    }
                ]
            }
        }
    ]
}

Sample Input: To update related list information
{
    "blueprint": [
       {
            "transition_id": "2000000031536",
            "data": {
                "Tasks": {
                    "Subject": "Event"
                }
            }
        }
    ]
}

Possible Errors

  • INVALID_MODULEHTTP 400

    The module name given seems to be invalid
    Resolution: You have specified an invalid module name or there is no tab permission, or the module could have been removed from the available modules. Specify a valid module API name.

  • INVALID_MODULEHTTP 400

    The given module is not supported in API
    Resolution: The modules such as Documents and Projects are not supported in the current API. (This error will not be shown, once these modules are been supported). Specify a valid module API name.

  • INVALID_URL_PATTERNHTTP 404

    Please check if the URL trying to access is a correct one
    Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: Client does not have ZohoCRM.modules.{module_name}.UPDATE scope. Create a new client with valid scope. Refer to scope section above.

  • NO_PERMISSIONHTTP 403

    Permission denied to update records
    Resolution: The user does not have permission to update blueprint data. Contact your system administrator.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in Server. Contact support team.

  • INVALID_REQUEST_METHODHTTP 400

    The http request method type is not a valid one
    Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above.

  • AUTHORIZATION_FAILEDHTTP 400

    User does not have sufficient privilege to update records
    Resolution: The user does not have the permission to update blueprint data. Contact your system administrator.

  • INVALID_DATAHTTP 400

    the id given seems to be invalid
    Resolution: You have specified an incorrect record ID. Please specify a valid record ID. Refer to Get Records API to get valid record IDs.

  • MANDATORY_NOT_FOUNDHTTP 400

    mandatory param missing
    Resolution: You have not specified one or more mandatory fields in the input. Refer to Fields Metadata API to know the mandatory fields.

Sample Response

Copied{
    "code": "SUCCESS",
    "details": {},
    "message": "transition updated successfully",
    "status": "success"
}