{"id":2783,"date":"2012-03-27T00:06:07","date_gmt":"2012-03-26T18:36:07","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2783"},"modified":"2015-03-25T15:44:00","modified_gmt":"2015-03-25T15:44:00","slug":"dynamic-approval-process-based-on-the-apex-and-trigger","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dynamic-approval-process-based-on-the-apex-and-trigger\/","title":{"rendered":"Dynamic Approval Process in Salesforce using Apex and Trigger"},"content":{"rendered":"<p>Although this is very common approach and lots of articles are around on this topic, still I want to delineate the topic in other way. This topic covers complete scenarios for the approval process based on the Apex class.<\/p>\n<p><strong>Agenda of this article:<\/strong><\/p>\n<ol>\n<li>Automatically submit the record for approval on the basis of field value.<\/li>\n<li>Automatically select the next Approver.<\/li>\n<li>Approve \/ Reject the record on the basis of field.<\/li>\n<\/ol>\n<p><strong>Assumptions:<\/strong><\/p>\n<ul>\n<li>Opportunity Object is used.<\/li>\n<li>Approval Process is already set on the Opportunity.<\/li>\n<li>Field &#8220;Next_Approver&#8221;\u009d will decide that who is going to approve the record.<\/li>\n<li>There are three steps in the approval process.<\/li>\n<li>There is no test class written and no check for mandatory fields needed for the trigger, as I have considered positive scenarios only.<\/li>\n<\/ul>\n<p><strong>Important URLS:<\/strong><\/p>\n<p>API of Approval Process classes:<\/p>\n<ol>\n<li><a title=\"ApexProcess Class\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_process.htm\">Apex process<\/a><\/li>\n<li><a title=\"ApexProcessRequest Class\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessRequest.htm\">Apex ProcessRequest<\/a><\/li>\n<li><a title=\"ApexProcessResult Class\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessResult.htm\">Apex_ProcessResult<\/a><\/li>\n<li><a title=\"ApexProcessSubmitRequest Class\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessSubmitRequest.htm\">Apex_ProcessSubmitRequest<\/a><\/li>\n<li><a title=\"ApexProcessWorkItemRequest Class\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessWorkitemRequest.htm\">Apex_ProcessWorkitemRequest<\/a><\/li>\n<\/ol>\n<p><strong>Steps of Standard approval process defined:<\/strong><\/p>\n<figure id=\"attachment_2787\" aria-describedby=\"caption-attachment-2787\" style=\"width: 545px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Approval-Process-Steps.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"  wp-image-2787\" title=\"Approval Process Steps\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Approval-Process-Steps.png?resize=545%2C109&#038;ssl=1\" alt=\"Approval Process Steps\" width=\"545\" height=\"109\" \/><\/a><figcaption id=\"caption-attachment-2787\" class=\"wp-caption-text\">Approval Process Steps<\/figcaption><\/figure>\n<p><!--more--><\/p>\n<p>To achieve this, I am going to create the trigger named &#8220;AutomateApprove&#8221;\u009d.<\/p>\n<p><strong>Automatically submit the approval process using trigger \u2013 Apex:<\/strong><\/p>\n<p>Below method is used to automatically submit the approval process using trigger.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic void submitForApproval(Opportunity opp)\r\n    {\r\n        \/\/ Create an approval request for the Opportunity\r\n        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();\r\n        req1.setComments('Submitting request for approval automatically using Trigger');\r\n        req1.setObjectId(opp.id);\r\n        req1.setNextApproverIds(new Id&#x5B;] {opp.Next_Approver__c});\r\n\r\n        \/\/ Submit the approval request for the Opportunity\r\n        Approval.ProcessResult result = Approval.process(req1);\r\n\r\n    }\r\n<\/pre>\n<p>Class &#8220;<a title=\"API Class reference\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessSubmitRequest.htm\">ProcessSubmitRequest<\/a>&#8220;\u009d is used to automatically submit the approval process. We need to set following items while submitting the approval process using trigger:<\/p>\n<ul>\n<li>Comment<\/li>\n<li>TargetObjectId<\/li>\n<li>NextApproverIds \u2013 if needed. Here Custom logic can be written to dynamically set approver for approval process. In this case I am using the custom field present on the Opportunity.<\/li>\n<\/ul>\n<p><strong>Automatically approve the approval process using trigger \u2013 Apex:<\/strong><\/p>\n<p>Below method is used to automatically approve the approval process using trigger.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\/*\r\n    * This method will Approve the opportunity\r\n    *\/\r\n    public void approveRecord(Opportunity opp)\r\n    {\r\n        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();\r\n        req.setComments('Approving request using Trigger');\r\n        req.setAction('Approve');\r\n        req.setNextApproverIds(new Id&#x5B;] {opp.Next_Approver__c});\r\n        Id workItemId = getWorkItemId(opp.id); \r\n\r\n        if(workItemId == null)\r\n        {\r\n            opp.addError('Error Occured in Trigger');\r\n        }\r\n        else\r\n        {\r\n            req.setWorkitemId(workItemId);\r\n            \/\/ Submit the request for approval\r\n            Approval.ProcessResult result =  Approval.process(req);\r\n        }\r\n    }\r\n<\/pre>\n<p>Class &#8220;<a title=\"API Class Reference\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessWorkitemRequest.htm\">ProcessWorkitemRequest<\/a>&#8220;\u009d is used to automatically approve the approval process. We need to set following items while submitting the approval process using trigger:<\/p>\n<ul>\n<li>Comment<\/li>\n<li>TargetObjectId<\/li>\n<li>NextApproverIds \u2013 if needed<\/li>\n<li>WorkItemId \u2013 Custom code required to get this<\/li>\n<\/ul>\n<p><strong>Get the WorkItemId for the pending approval process of the Object:<\/strong><br \/>\nThis is the tricky part, if the Submission and approval of the record is done in single code block then it&#8217;s very easy to get the WorkItemId of the needed process.<\/p>\n<p><strong>Here the standard code snap provided:<\/strong><\/p>\n<p>After Submission the approval process using Apex we get the object of class &#8220;<a title=\"API Class Reference\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_ProcessResult.htm\">ProcessResult<\/a>&#8220;\u009d.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nApproval.ProcessResult result = Approval.process(req1);\r\n<\/pre>\n<p>And from the class we can get workitemid as :<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nList&lt;Id&gt; newWorkItemIds = result.getNewWorkitemIds();\r\n<\/pre>\n<p>And set the id like:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nreq2.setWorkitemId(newWorkItemIds.get(0));\r\n<\/pre>\n<p><strong>Other method to get the &#8220;WorkItemId&#8221;\u009d :<\/strong><br \/>\nThe above code was not usable in our scenario as the submission and approval or rejection was done at different level. So I have created following utility method to get the WorkitemId of the supplied Object&#8217;s id. Here I have considered that only one workitem will present.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic Id getWorkItemId(Id targetObjectId)\r\n    {\r\n        Id retVal = null;\r\n\r\n        for(ProcessInstanceWorkitem workItem  : &#x5B;Select p.Id from ProcessInstanceWorkitem p\r\n            where p.ProcessInstance.TargetObjectId =: targetObjectId])\r\n        {\r\n            retVal  =  workItem.Id;\r\n        }\r\n\r\n        return retVal;\r\n    }\r\n<\/pre>\n<p>As you can see, we need to query the object &#8220;<strong>ProcessInstanceWorkitem<\/strong>&#8220;\u009d to get workitemId of the object.<\/p>\n<p><strong>Automatically reject the approval process using trigger \u2013 Apex:<\/strong><br \/>\nFollowing code is used to reject the approval process using code.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic void rejectRecord(Opportunity opp)\r\n    {\r\n        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();\r\n        req.setComments('Rejected request using Trigger');\r\n        req.setAction('Reject');\r\n        \/\/req.setNextApproverIds(new Id&#x5B;] {UserInfo.getUserId()});\r\n        Id workItemId = getWorkItemId(opp.id); \r\n\r\n        if(workItemId == null)\r\n        {\r\n            opp.addError('Error Occured in Trigger');\r\n        }\r\n        else\r\n        {\r\n            req.setWorkitemId(workItemId);\r\n            \/\/ Submit the request for approval\r\n            Approval.ProcessResult result =  Approval.process(req);\r\n        }\r\n    }\r\n<\/pre>\n<p><strong>Execution of Approval process using Apex and trigger:<\/strong><\/p>\n<figure id=\"attachment_2790\" aria-describedby=\"caption-attachment-2790\" style=\"width: 655px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Approval-Process-Log-After-Execution.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"   wp-image-2790\" title=\"Approval Process Log After Execution\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Approval-Process-Log-After-Execution-1024x215.png?resize=655%2C138&#038;ssl=1\" alt=\"Approval Process Log After Execution\" width=\"655\" height=\"138\" \/><\/a><figcaption id=\"caption-attachment-2790\" class=\"wp-caption-text\">Approval Process Log After Execution<\/figcaption><\/figure>\n<p><strong>Complete code:<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\ntrigger AutomateApprove on Opportunity(After insert, After update)\r\n{\r\n\r\n    for (Integer i = 0; i &lt; Trigger.new.size(); i++)\r\n    {\r\n     try\r\n     {\r\n        if( Trigger.isInsert || (Trigger.new&#x5B;i].Next_Step__c == 'Submit' &amp;&amp; Trigger.old&#x5B;i].Next_Step__c != 'Submit'))\r\n        {\r\n           submitForApproval(Trigger.new&#x5B;i]);\r\n        }\r\n        else if(Trigger.isInsert || (Trigger.new&#x5B;i].Next_Step__c == 'Approve' &amp;&amp; Trigger.old&#x5B;i].Next_Step__c != 'Approve'))\r\n        {\r\n             approveRecord(Trigger.new&#x5B;i]);\r\n        }\r\n        else if(Trigger.isInsert || (Trigger.new&#x5B;i].Next_Step__c == 'Reject' &amp;&amp; Trigger.old&#x5B;i].Next_Step__c != 'Reject'))\r\n        {\r\n             rejectRecord(Trigger.new&#x5B;i]);\r\n        }\r\n     }catch(Exception e)\r\n     {\r\n         Trigger.new&#x5B;i].addError(e.getMessage());\r\n     }\r\n    }\r\n\r\n    \/**\r\n    * This method will submit the opportunity automatically\r\n    **\/\r\n    public void submitForApproval(Opportunity opp)\r\n    {\r\n        \/\/ Create an approval request for the Opportunity\r\n        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();\r\n        req1.setComments('Submitting request for approval automatically using Trigger');\r\n        req1.setObjectId(opp.id); \r\n\r\n        req1.setNextApproverIds(new Id&#x5B;] {opp.Next_Approver__c});\r\n\r\n        \/\/ Submit the approval request for the Opportunity\r\n        Approval.ProcessResult result = Approval.process(req1);\r\n    }\r\n\r\n\t\/**\r\n\t* Get ProcessInstanceWorkItemId using SOQL\r\n\t**\/\r\n    public Id getWorkItemId(Id targetObjectId)\r\n    {\r\n        Id retVal = null;\r\n\r\n        for(ProcessInstanceWorkitem workItem  : &#x5B;Select p.Id from ProcessInstanceWorkitem p\r\n            where p.ProcessInstance.TargetObjectId =: targetObjectId])\r\n        {\r\n            retVal  =  workItem.Id;\r\n        }\r\n\r\n        return retVal;\r\n    }\r\n\r\n    \/**\r\n    * This method will Approve the opportunity\r\n    **\/\r\n    public void approveRecord(Opportunity opp)\r\n    {\r\n        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();\r\n        req.setComments('Approving request using Trigger');\r\n        req.setAction('Approve');\r\n        req.setNextApproverIds(new Id&#x5B;] {opp.Next_Approver__c});\r\n        Id workItemId = getWorkItemId(opp.id); \r\n\r\n        if(workItemId == null)\r\n        {\r\n            opp.addError('Error Occured in Trigger');\r\n        }\r\n        else\r\n        {\r\n            req.setWorkitemId(workItemId);\r\n            \/\/ Submit the request for approval\r\n            Approval.ProcessResult result =  Approval.process(req);\r\n        }\r\n    }\r\n\r\n    \/**\r\n    * This method will Reject the opportunity\r\n    **\/\r\n    public void rejectRecord(Opportunity opp)\r\n    {\r\n        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();\r\n        req.setComments('Rejected request using Trigger');\r\n        req.setAction('Reject');\r\n        Id workItemId = getWorkItemId(opp.id);   \r\n\r\n        if(workItemId == null)\r\n        {\r\n            opp.addError('Error Occured in Trigger');\r\n        }\r\n        else\r\n        {\r\n            req.setWorkitemId(workItemId);\r\n            \/\/ Submit the request for approval\r\n            Approval.ProcessResult result =  Approval.process(req);\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p><strong>Note on possible errors:<\/strong><\/p>\n<p>1.If you have the &#8220;manual Selection of approver&#8221;\u009d enabled for your approval process\/steps then you must specify the approver in the trigger, else you will get an error something like:<\/p>\n<blockquote><p>&#8220;System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []&#8221;\u009d<\/p><\/blockquote>\n<p>2.If you set the wrong WorkitemId then may get following error:<\/p>\n<blockquote><p>Process failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []<\/p><\/blockquote>\n<p><em>updated on 25-March-2015<\/em><\/p>\n<p><strong>Question :<\/strong><br \/>\n<strong>1. Can we add multiple users (Parallel Approval process) as a aprrover automated using above code?<\/strong><br \/>\nAns : No. Logic in above code is that we need to select next approver option as &#8220;manual&#8221;. Currently we cannot use multiple users manually in approval process, <a title=\"Approval Process- Allow submitter to manually select multiple approvers\" href=\"https:\/\/success.salesforce.com\/ideaView?id=08730000000j9WaAAI\" rel=\"nofollow\">you can vote this idea for this feature support<\/a>. Only solution is to have multiple steps for each approver.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explain the Automatic submission of Approval process using Apex and trigger. It include Automatic submission, approval as well as rejection of record completely using Apex and trigger.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,24,9],"tags":[337,300,331,203],"class_list":["post-2783","post","type-post","status-publish","format-standard","hentry","category-apex","category-force-com","category-salesforce","tag-apex","tag-approval-process","tag-salesforce","tag-trigger"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4546,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/system-mode-or-god-mode-in-apex-gotchas\/","url_meta":{"origin":2783,"position":0},"title":"System mode or God mode in Apex &#8211; Gotchas","author":"Jitendra","date":"June 8, 2015","format":false,"excerpt":"Gotchas of System mode or God mode in Apex and its impact by using \"With sharing\" keyword in Salesforce","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"Salesforce God Mode failing","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Salesforce-God-Mode-failing.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Salesforce-God-Mode-failing.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Salesforce-God-Mode-failing.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3773,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-faq-part-19\/","url_meta":{"origin":2783,"position":1},"title":"Salesforce interview questions &#8211; Part 19","author":"Jitendra","date":"December 16, 2014","format":false,"excerpt":"Salesforce interview questions for developers and admins around Apex, Visualforce, getting Salesforce object name on basis of Id, Apex API limits","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1305,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-3\/","url_meta":{"origin":2783,"position":2},"title":"Salesforce Interview Questions \u2013 Part 3","author":"Jitendra","date":"October 12, 2010","format":false,"excerpt":"Most Frequently Asked interview questions of Apex, Visual force, SOQL in Salesforce.com SFDC","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1241,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/step-by-step-salesforce-tutorial-creating-trigger-and-test-cases-6-of-6\/","url_meta":{"origin":2783,"position":3},"title":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and Test cases \u2013 6 of 6","author":"Jitendra","date":"October 11, 2010","format":false,"excerpt":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and test cases \u2013 6 of 6 tutorials series","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Creating Trigger in Salesforce using force.com IDE","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/10\/Creating-Trigger-in-Salesforce-using-force.com-IDE.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3411,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/apex-interview-question-salesforce-part-16\/","url_meta":{"origin":2783,"position":4},"title":"Apex Interview Question \u2013 Salesforce &#8211; Part 16","author":"Jitendra","date":"July 28, 2013","format":false,"excerpt":"151. Give Sample Code Snippet of Apex that that will show that how Parent and Child record can be inserted in Single Statement ? Ans : It can be done with help of External Id. [java] Date dt = Date.today().addDays(7); Opportunity newOpportunity = new Opportunity(Name = 'shivasoft', StageName = 'Prospecting',\u2026","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5662,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/send-visualforce-as-an-email-attachment-from-apex-trigger-alternate-design\/","url_meta":{"origin":2783,"position":5},"title":"Send Visualforce as an email attachment from Apex Trigger &#8211; Alternate design","author":"Jitendra","date":"August 27, 2016","format":false,"excerpt":"Process Builder & InvocableMethod- Alternative to send Visualforce as an email attachment from Apex Trigger","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Send Visualforce as an email attachment from Apex Trigger","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/Send-Visualforce-as-an-email-attachment-from-Apex-Trigger.jpg?fit=922%2C369&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/Send-Visualforce-as-an-email-attachment-from-Apex-Trigger.jpg?fit=922%2C369&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/Send-Visualforce-as-an-email-attachment-from-Apex-Trigger.jpg?fit=922%2C369&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/Send-Visualforce-as-an-email-attachment-from-Apex-Trigger.jpg?fit=922%2C369&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2783"}],"version-history":[{"count":5,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2783\/revisions"}],"predecessor-version":[{"id":4358,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2783\/revisions\/4358"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}