Example: Creating and Updating a Record using Go To Record Quick Action with Webhook Values (GAD)
6 min
role administrator minimum version 2023 4 prerequisites to use the go to record s , set the global constant enableactionservice to true this example shows you how to do the following tasks using the go to record using webhook supplied values when using go to record, when the record that we want to go to does not exist, this example shows you how to create a new record with the information provided in the go to record shows that the new record gets the focus by updating a value in the record using the update a record how to supply all the values for go to record, creating the record, and update a record using a webhook the webhook values are stored in the update variables and stored values for use in the actions the postman application is used as the rest api client when sending the webhook post request to the execute endpoint three sets of tasks have to be completed before you can send an execute request to webhooks in create a composite action with the actions update variables and stored values , go to record , and update a record in an existing business object (we used the project business object in this instance) create a webhook referring to the composite action created above create an api key to use as authorization in the execute post request item 1 create a composite action for the project business object log in to as an administrator go to the configuration console > build > business objects > project > quick actions > graphical action designer under advanced actions , find the update variables and stored values and then drag the block on to the designer board in the common settings tab, enter a name in the name field, for example, createandupdatewithgtrwithwhvalues this is the name for the whole set of actions select auto save auto save preserves any changes made up to that point if a problem occurs when using a composite action in the block settings tab, click editor select or enter the following values field parameter variable type variable variable name webhookbody data type json or xml value (json) value (xml) {} \<xml>\</xml> click ok at the bottom of the screen under record actions , find the go to record and then drag and drop the block on to the designer board link the go to record block to the update variables and stored values block so that the latter is the second block in the chain in the block tab of go to record , the business object field is prepopulated with the current business object name and cannot be edited enter the field values field parameter field name recid (record identifier) field value 1 create a new record if not found selected enter values as per below for populating the new record on creation use + add field to add more field value pairs as needed field parameter field name projectname (project) field value (json) field value (xml) $(jsonpathvalue(variable("webhookbody"), "$ gotonamevalue")) $(xpathvalue(variable(“webhookbody”), "gotonamevalue")) field parameter field name summary field value (json) field value (xml) $(jsonpathvalue(variable("webhookbody"), "$ summary")) $(xpathvalue(variable(“webhookbody”), "summary")) field parameter field name projectownerlink (project owner) field value $(currentuserrecid()) field parameter field name projectstartdate (start date) field value $(currentdatetime()) under record actions , find the update a record and then drag and drop the block on to the designer board link it to the go to record block so that it is third in line to be run in the composite action in the block tab of update a record , select or enter values as per below field parameter field name summary field value (json) field value (xml) $(jsonpathvalue(variable("webhookbody"), "$ secondsummary")) $(xpathvalue(variable(“webhookbody”), "secondsummary")) click save item 2 create a webhook referring to the composite action created above log in to as an administrator go to the configuration console > build > webhooks manager click + add a new webhook populate the fields as follows field parameter name createandupdatewithgtrwithwhvalues endpoint extension webh2 status enabled business object project (frs project) action createandupdatewithgtrwithwhvalues (choose the composite action you just created from the list) click save item 3 create the api key log in to as an administrator go to the configuration console > configure > security controls > api keys click add api key within one of the key groups to create a new api key for webhooks enter values for the fields as follows field parameter description webhook api key on behalf of your user name in role administrator click save key click back to go to the api keys list page make a note of your api key this is used as the authorization value in the execute post request executing the webhook and composite action open postman or a similar application that can send http requests create a post request for the execute endpoint by providing a url with endpointextension, an authorization header and a json/xml body as per below in the post request header, add your previously noted api key as shown in the image add the case sensitive endpoint extension on to the end of the post url https //\[your server]/api/rest/webhooks/execute?extension=webh2 the post url is shown when creating the webhook in the json body, send the values to be used by the quick action variable for example { "gotonamevalue" "new record", "summary" "summary updated", "secondsummary" "summary updated second time" } xml \<xml> \<gotonamevalue>new record\</gotonamevalue> \<summary>summary updated\</summary> \<secondsummary>summary updated second time\</secondsummary> \</xml> there should not be an existing record with the same value as the gotonamevalue in the project workspace, name column click send verify that you received a status 200 ok for a successful response in postman in , open the project workspace and check if a new record has been created using the fields and values in the create a new record section of the go to record action in step 12 a new record with the webhook values sent via postman should have been created with name =new record the summary of the record with the name ( gotonamevalue provided in the json/xml body) has been updated with the secondsummary value provided in the json/xml body (see step 2 in this section) the summary value for the new record has the value provided for the secondsummary field the go to record creates a new record with the values from the webhook and goes to that record the update a record then uses the value from the webhook secondsummary (see step 15) and updates the summary value of the record
