How we store the Record Producer Fields details in table contain field as json/script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 09:14 AM
Hi @LL
I created 1 Record Producer on Test Case table in PDI
Now i want to stored the Record Producer Field details-Test Case Number in table-Test Case in Field Test Result which is script type or Json when user Submitted the Record on Form.
Please suggest on this how we stored the Fields details in json format in Table.
Thanks in advance
Divya Kumari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 10:00 AM - edited 02-16-2024 12:19 PM
Hi @Kumari Divya ,
You can prepare a JSON object for Test Number and update this field via record producer's script part.
Replace the test_case and test_result variables as per in your system.
Tested on Create Incident Record Producer and result as below.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 02:46 AM
Hi @AshishKM
Could you please help me on how i get the json details from record producer in below format.
{"u_supplier_ship_date":[{"original_value":"abc","changed_value":" abcjdck"}]}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 05:21 AM
try the below code
var result ={};
var data ={};
var dataArray= [];
data.original_data = "abc"; // use producer.<fieldName> coming from catalog form
data.changed_value = "xyz"; //use producer.<fieldName> coming from catalog form
dataArray.push(data); // add data object in array
result.u_supplier_ship_date=dataArray;
current.description= new global.JSON().encode(result);
Used in 'Create Incident' record producer
result :
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 09:30 AM
Hi @AshishKM
Can you please help me how can i used if block inside the RP and only stored the value in Table if value changed in form.We have 2 fields on RP,if fields are updated on RP then that will store in table and if both fields are updated then both should save in Json field on table.
i tried the below code
var testResult= {};
if(producer.ship_date !=producer.new_ship_date){
testResult.shipDate = producer.ship_date.toString();
testResult.newShipDate =producer.new_ship_date.toString();
current.json_output =new global.JSON().encode(testResult);
}
var testResult1= {};
else if(producer.cancel !=producer.new_cancel){
testResult.cancel = producer.cancel.toString();
testResult.newCancel =producer.new_cancel.toString();
current.json_output =new global.JSON().encode(testResult1);
}
Thanks in advance
Divya