Business Requirement and Challenges
Oracle Visual Builder is a powerful tool allowing extending Oracle SaaS application with User Interface adjusted to concrete user’s requirements.
The out-of-the-box option of updating an extensible flexfield for a fulfillment line (Additional Line Information) is to select the action to open Additional Line Information popup and update it there.
We are developing a table presenting line with Additional Information in a grid with line and Additional Information in a single line and need to allow updating the Additional Information by using standard REST API.
Oracle SaaS provides API to perform line update with Additional Information:
https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/23b/fasrp/op-salesordersfororderhub-orderkey-child-lines-linesuniqid-patch.html
As it shown in the document, in order to update the line we have to provide order key (which can be order headerId) and like key – that should be calculated for our current HTTP session.
Although in Postman line key can receive fulfillment line id, in Visual Builder – it does not work and we have to calculate current hash value generated for our lines to allow their update.
Solution
High level overview of the solution:
- By using REST query in Postman identify the internal name of Additional Information content you want to update:
- Add to Visual Builder PATCH service endpoint to perform update of existing Additional Information record:
- Add to Visual Builder POST service endpoint to create new Additional Information record for existing fulfillment line:
- Implement the logic inside Save action chain:
- Call REST to fetch current order line
- Use javascript to parse the result of the REST call above to extract the line key value and populate a variable with it.
let h = getOrderLineDetailsResponse.body.items[0].additionalInformation[0].links.filter( l => { return l.name == “Your Additional Information Name”; } )[0].href;
$page.variables.currLineKey = h.substring(h.indexOf(‘/lines’)+7, h.indexOf(‘/child/additionalInformation’)); - Identify if we in PATCH/POST mode
- Call relevant update/create API