Skip to content

How do I remove null if the "If" condition is false #303

Closed Answered by FoolMuun
akashvekariya asked this question in Q&A
Discussion options

You must be logged in to vote

Try this...

JSLT

let r = .records[0] 
let p = $r.OrderItems.records 

{ "details_view": 
    [for(array([ { 
          "display_as": "details", 
          "data": { 
               "date": $r.CreatedDate, 
               "status": $r.StatusCode
          } 
       },
       if ($p)
       { 
          "display_as": "columns", 
          "caption": "products", 
          "data": [
               for ($p) { 
                   "product": .PricebookEntry.Product2.Name, 
                   "quantity": .Quantity, 
                   "price": .UnitPrice 
               }
          ] 
        } 
    ])). if( . != null)]
}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@akashvekariya
Comment options

Answer selected by akashvekariya
Comment options

You must be logged in to vote
1 reply
@akashvekariya
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants