09-20-2021 05:42 AM
Hi Everybody,
Kindly help.
Am trying to insert a dynamic value under the **value** array using extend function but unable to do so.
[
{
"entity":
{
"attributes":
{
"type":"CustomField","url":"A"
}
"Metadata":
{
"valueSet":
{
"value":
[
{
"color":null,"default":false,"description":null,"isActive":null,"label":"None","urls":null,"valueName":"None"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Country","urls":null,"valueName":"Country"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Employee","urls":null,"valueName":"Employee"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Both","urls":null,"valueName":"Both"
}
]
},
},
},
},
{
"src_code":"Active","tgt_code":null
}
]
Output:
[
{
"entity":
{
"attributes":
{
"type":"CustomField","url":"A"
}
"Metadata":
{
"valueSet":
{
"value":
[
{
"color":null,"default":false,"description":null,"isActive":null,"label":"None","urls":null,"valueName":"None"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Country","urls":null,"valueName":"Country"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Employee","urls":null,"valueName":"Employee"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Both","urls":null,"valueName":"Both"
},
{
"color":null,"default":false,"description":null,"isActive":null,"label":"Active","urls":null,"valueName":"Active"
}
]
},
},
},
}
]Preformatted text
09-20-2021 06:46 AM
Hi @KTsnap,
If I understood well, you want to add another element to the array, and fields which will be in the new element will be populated from the object which is bellow. Am I right ?
{
"src_code": "Active",
"tgt_code": null
}
09-20-2021 07:28 AM
Hi Viktor,
I want to insert new record in the below given array .If suppose there are 4 records under the value array. I want to add the 5th record in the array of value if the another input is { "src_code" : "Active"}
“value”:
[
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“None**”,“urls”:null,“valueName”:“None”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“Country**”,“urls”:null,“valueName”:“Country”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“Employee”**,“urls”:null,“valueName”:“Employee”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,**“label”:“Both”,**“urls”:null,“valueName”:“Both”
}
]
{
"src_code":"Active",
"tgt_code":null
}
expected Output
“value”:
[
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“None**”,“urls”:null,“valueName”:“None”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“Country**”,“urls”:null,“valueName”:“Country”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,“**label”:“Employee”**,“urls”:null,“valueName”:“Employee”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,**“label”:“Both”,**“urls”:null,“valueName”:“Both”
},
{
“color”:null,“default”:false,“description”:null,“isActive”:null,**“label”:“Active”,**“urls”:null,“valueName”:“Active”
}
]
Please let me know if it is unclear.
type or paste code here
09-20-2021 09:27 AM
09-20-2021 10:21 AM
Yes Viktor. and that object needs to be removed in the output. and the number of input object would be dynamic.
{
“src_code”: “Active”,
“tgt_code”: null
}