- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:42 AM
Is there any way to retrieve a widget data and create a new Record Producer based on that data.
If someone have a solution please advice me to achieve this.
I want to create a new Record Producer based on this details. (New Record Producer as a Name) and others as Variables.
Regards,
Anna.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 01:11 PM
Hi Anna,
It appears you and I have similar requirements. My widget contains a table, with basic functionality like adding rows and inline editing.
The only way i've discovered to pass the data object is create a hidden catalog variable to store the serialized data object.
Widget client script:
$scope.page.g_form.setValue("hidden_widget_value", angular.toJson(c.data.notes));
Then on catalog client script you could do something like :
function onSubmit() {
var data_from_widget = g_form.getValue('hidden_widget_value');
/* parse string to object, then iterate object to insert records into table */
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 07:30 AM
Hi kristoffermoncada ,
I can get the JSON data from the widget as below,
But unable to get the particular values.
Just tried to get the user entered values as "json_output.fields.value".
Is there any way to get the values alone from the JSON data and add that as a Record Producer variable name and questions?
Regards,
Anna.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 09:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 09:29 AM
var json_output = [{
"number": 0,
"fields": [{
"label": "Field Name",
"type": "text",
"value": "Test Name"
}, {
"label": "Field Type",
"type": "text",
"value": "Test Type"
}, {
"label": "Question",
"type": "text",
"value": "Test"
}]
}];
console.log(json_output[0].fields[0].label); //Field Name
console.log(json_output[0].fields[1].label); //Field Type
console.log(json_output[0].fields[2].label); //Question
As for creating the record producer variable.... I would investigate the table "item_option_new".
I have yet to do this, BUT it appears you can add records to this table (with all the necessary fields) and that should create your record producer variables dynamically.
Someone like ctomasi, is more qualified to answer this question.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2017 12:33 PM
Do we need to include the code in a client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 10:17 AM
How do you implement the add row thing?