Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using Conditions inside modify-overwrite-beta transformation specs for type conversion #1218

Open
abhinaypandey opened this issue Sep 19, 2023 · 0 comments

Comments

@abhinaypandey
Copy link

abhinaypandey commented Sep 19, 2023

Hi,
I have a requirement where I want to convert string values to Boolean, Integer or Decimal based on a property called 'field_data_type'. When value against field_data_type is boolean I want to convert the 'value' field to boolean and similarly for Integer conversion.

Is there a way I can achieve this using Jolt spec. Here is my sample input.

{ "name": "Consumer", "email": "", "form_id": "G0FZJeRPTsep6kjqBuxvKg", "tags": [], "field_list": [ { "name": "Hungry", "value": "true", "required": false, "source": "External", "id": "8fz9bob1Rt-JF3DJT2XeLg", "ui_property": "single-select", "field_data_type": "boolean", "is_editable": false, "visible": false, "related_to": "Ticket", "target_property": "conversation::hungryBool", "is_agent_only": false, "is_custom_field": true, "is_auto_generated": false, "is_prefill_variable": false, "prefill_value": "", "is_visible_to_customer": true, "is_active": true }, , { "name": "Lot Number", "value": "1", "required": false, "source": "External", "id": "TzMfuHwXSUioVxulzSwxeA", "ui_property": "text", "field_data_type": "number", "is_editable": false, "visible": false, "related_to": "Ticket", "target_property": "customer::lotNumberTxt", "is_agent_only": false, "is_custom_field": true, "is_auto_generated": false, "is_prefill_variable": false, "prefill_value": "", "is_visible_to_customer": true, "is_active": true } ]

My current spec is this 

[ { "operation": "modify-overwrite-beta", "spec": { "field_list": { "*": { "target_property_split": "=split('::', @(1,target_property))", "kustomer_attribute_type": "@(1,target_property_split[0])", "attribute_target_property": "@(1,target_property_split[1])" } } } }, { "operation": "shift", "spec": { "requester": { "type": { "Customer": { "@(2,id)": "customer" } } }, "field_list": { "*": { "kustomer_attribute_type": { "conversation": { "@(2,is_custom_field)": { "true": { "@(4,value)": "custom.@(5,attribute_target_property)" }, "*": { "@(4,value)": "@(5,attribute_target_property)" } } } } } } } } ]

@abhinaypandey abhinaypandey changed the title using Conditions inside modify-overwrite-beta transformation specs using Conditions inside modify-overwrite-beta transformation specs for type conversion Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant