cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

jsonpath in expression library

reuben
New Contributor

I would like to use a jsonpath in an expression library, but I am unsure of the syntax with parameters.

custfield is a json array of custom field data and fieldname is a string

This is what I attempted:

{
customField: (custfield,fieldname) => jsonPath($, "custfield[*]").find(f=>f.FieldName==fieldname)
}

What should the syntax be?

2 REPLIES 2

Chandan
New Contributor III

Could you share the sample JSON and expected response ?

reuben
New Contributor

Fieldname would be Lateral Size and the return would be 5 (what's found in the matching PickListItems to the Value found in that custom field).  Below is what would be found in custfield.

 [{
"CustomFieldId": "68f40528-4d63-6a70-60d6-0797407c53d7",
"CustomFieldLayoutControlType": 2,
"CustomFieldType": 5,
"FieldName": "LateralSize",
"FieldTip": "",
"DefaultValue": "",
"Label": "Lateral Size",
"Formula": "",
"IsRequired": true,
"IsActive": true,
"IsLabelSurpressed": false,
"AllowMultipleSelections": false,
"IsRequiredInCAP": true,
"PickListItems": [
{
"CustomFieldPickListItemID": "28bd8b11-dfd5-f514-a694-320be7078e59",
"Value": "5",
"Order": 1,
"Retire": false,
"IsMultiSelected": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
},
{
"CustomFieldPickListItemID": "2b58d501-5584-bfbb-a622-54778262cf3f",
"Value": "6",
"Order": 2,
"Retire": false,
"IsMultiSelected": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
}
],
"IsReadOnly": false,
"FieldType": 5,
"ControlType": 2,
"Value": "2b58d501-5584-bfbb-a622-54778262cf3f",
"DependentFormulas": [],
"FormulaFields": [],
"TotalWorksheetNumericValue": 0.0,
"IsWorksheet": false,
"ColumnHeaderName": "",
"CanWorksheetItemsWrite": true,
"WorksheetItems": [],
"CustomFieldTableRows": [],
"CustomFieldTableCellType": 0,
"CustomFieldTableRowNumber": 0,
"IsTableColumnEntry": false,
"IsTable": false,
"IsValidationSurpassed": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
},
{
"CustomFieldId": "09a0e02d-ae97-431e-74b6-4ea9ecdd742d",
"CustomFieldLayoutControlType": 1,
"CustomFieldType": 5,
"FieldName": "StreetofConnection",
"FieldTip": "",
"DefaultValue": "",
"Label": "Street of Connection",
"Formula": "",
"IsRequired": true,
"IsActive": true,
"IsLabelSurpressed": false,
"AllowMultipleSelections": false,
"IsRequiredInCAP": true,
"PickListItems": [],
"IsReadOnly": false,
"FieldType": 5,
"ControlType": 1,
"Value": "asdf",
"DependentFormulas": [],
"FormulaFields": [],
"TotalWorksheetNumericValue": 0.0,
"IsWorksheet": false,
"ColumnHeaderName": "",
"CanWorksheetItemsWrite": true,
"WorksheetItems": [],
"CustomFieldTableRows": [],
"CustomFieldTableCellType": 0,
"CustomFieldTableRowNumber": 0,
"IsTableColumnEntry": false,
"IsTable": false,
"IsValidationSurpassed": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
}
]