2

I am quite newb when it comes to Omnistudio, just getting the grips of it.

I have two flex cards, parent and child.

The parent is just a collapsible toggle, and shows/hides child card.

Child card is a bunch of quote line items and their prices.

Ideally I'd like to show a total for all the items fetched in the quote line items. I cannot think of a solution here other than have another child flex card which takes the {records} param from other child card and then somehow Sums up what is in the Invoice_Amount_Inc_VAT__c field.

How do I do such sum? I've tried a Data raptor formula but cannot for the life of me make it work to sum up a given JSON.

Here is the example enter image description here

I am using parent child because next phase of this will be implementation of an action button against each element, such as remove, which will delete that quote line item.

Any help or guidance is much appreciated. vio

1 Answer 1

2

For data extraction and transformation requirements other than just retrieving data, I would opt to wrap everything in an Integration Procedure and tailor the response to properly display the information in the flexcard.

The JSON that the Flexcard needs to receive should be something like:

{ "QuoteLineItem": [ { "ProductName": "QuoteLine 1", "TotalPrice": 7 }, { "ProductName": "QuoteLine 2", "TotalPrice": 5 }, { "ProductName": "QuoteLine 3", "TotalPrice": 15 }, { "ProductName": "QuoteLine 4", "TotalPrice": 1000 } ], "GrandTotal": 1027 } 

In order to sum the TotalPrice field, you can use the sum function. See Salesforce help files here

The formula would look something like this:

SUM(QuoteLiteItem:TotalPrice) 

I put the formula in a Set Value Action and then used the Response Action to create the response JSON:

enter image description here

You can then use a merge field on the parent Flexcard for displaying the Grand Total and the child Flexcard to display the Quote Line Items:

enter image description here

Good luck!

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.