Hi Experts,
Please help me to resolve my issue.
I want to convert the following data returned in "Text" format into a list of dictionary/map and afterwards map these fields to a CDT.
{ "IPAddress": "111.101.1111.11", "StartDate": "2024/06/26", "StartTime": "23:24:49", "StartTimezone": "UTC", "EndDate": "2024/06/28", "EndTime": "17:38:12", "EndTimezone": "UTC" }& { "IPAddress": "111.111.1101.11", "StartDate": "2024/07/02", "StartTime": "02:52:07", "StartTimezone": "UTC" }& { "IPAddress": "111.111.1110.11", "StartDate": "2024/07/07", "StartTime": "18:10:37", "StartTimezone": "UTC", "EndDate": "2024/07/09", "EndTime": "03:50:30", "EndTimezone": "UTC" }& { "IPAddress": "111.111.1111.10", "StartDate": "2024/07/16", "StartTime": "07:36:39", "StartTimezone": "UTC", "EndDate": "2024/07/17", "EndTime": "23:01:19", "EndTimezone": "UTC" }
Appreciate your help!
Discussion posts and replies are publicly visible
I'm to facing same issue with the prompt builder noting helps in adding comments to the prompt builder. KIndly let me know the steps to sort this issue.
What is your exact issue?
Are you sure you need that toJson?
The AI returns a string, which you store to a PV. Then you call your expression which expects a string, which you already have.
I Tried it without toJSON now my PV extract data return {} attached 3 images
It feels like the data you feed into your expression is not what you expect. I suggest to validate this.
this is what im expecting and im getting it in rule but not in script task
Sure, then validate the way the data takes from the AI up to the script task. Does this meet your expectations in real process instances? Check the datatypes and values.
it is as expected from AI to PV
Do you have any additional save configurations in "Data" -> "Inputs" of that script task?
Nothing in input
Did you check that all the field names in the JSON do match the field names in your record? In your latest expression you do a simple cast. For this to work, the field names have to match exactly.
only some fields match and the rest are neglected by appian. For the matching fields im gettting output as expected in expression rule
My remote debugging powers are exhausted.
I situations like this, I build an extremely simplified test case, leaving out any complexities. Once I understand how things work, I start adding back more of the complexity. This way I typically understand what I did wrong, but did not see because things were more complex than I could handle.
Just say me how to achieve this in step by step process:I'm getting JSON output from AI prompt Builder as shown in above screen shots. Now I need to store them to my Record type with their respective fields. Help me just on this.
I think that you are doing the correct steps.
- Call AI to get the JSON string
- Store that string as a PV
- In Script Task, pass that PV to an expression to transform it into your Record
- Store the record to a PV
- Write record
Now, obviously, something is going wrong. And I am out of questions I could ask you.
And you are a certified Senior Developer.
BTW, I just wrote a blog post about how to debug Appian: appian.rocks/.../
Could your team help me on this case, can they try it from their end once this usecase. As this is a client requirement for me I need to figure out stuff.
When the keys don't match the fields of your record, it will return null, and if your record is multiple, it will return {}. First, check that the fields of the json you send as parameters are equal to those of the fields of your record.
SOLUTION : Once casting is done in expression rule dont't try to save it in the PV which has record type data type if you do so it will throw {} null in value. Instead, once casted try to store in PV which has map data type in it, and from map PV try to map it to your record type it will work .