- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 05:37 AM
Hi All,
I am trying to autopopulate multi -row variable set through widget. I have added the below script in client controller. I am unable to set the variables in variable sets. Please help. i am doing anything wrong here.
var my_varset_three_way = $scope.page.g_form.getField("invoice_line_items");
for (var sKey in details) {
if (sKey == "invoice_line_items") {
alert(sKey);
alert($scope.page.g_form.getValue(sKey));
$scope.page.g_form.setValue(sKey, details[sKey]); //This will set the multirow once the key is matched.
}
Thanks & Regards
Swathi Padighar
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 02:06 AM
I am able to achieve it by converting all the variables into String as few the variables are in numeric values so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 08:05 AM
if poLIne is your value and you need to update the variable in the JSON , update the JSON and then set it like below
parsed[i].your_field_name_to_be_udpated
make sure you replace the variable back end name which you want to set in the above line in the script
$scope.fieldChange = function(poLine) {
var three_way = $scope.page.g_form.getValue("invoice_line_items_three_way");// variable set
var parsed =JSON.parse(three_way);
for (var i=0; i<parsed.length; i++) {
parsed[i].your_field_name_to_be_udpated = poLine;
}
$scope.page.g_form.setValue('invoice_line_items_three_way', JSON.stringify(parsed));
};
MARK THIS NASWER CORRECT IF THIS HELPS YOU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 08:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 09:04 PM
I tried it its not working and poLine is an object i need to set 7 variables in variable set . I need to set those variables in variable set through poLine object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 09:34 PM
I want to set variables in variable set. How can i achieve it. Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2022 01:00 AM
hello
then try this so if poLine is a JSON and you want to set the individual elements in that JSON to MVRS
For better understanding send me the Poline object i might help you in accessing elements.
i am assuming your poLine is in this below format
poLine = {
"key1":"value1",
"key2":"value2",
"key3":"value3",
"key4":"value4",
"key5":"value5,
"key6":"value6",
"key7":"value7",
}
$scope.fieldChange = function(poLine) {
var three_way = $scope.page.g_form.getValue("invoice_line_items_three_way");// variable set
var parsed =JSON.parse(three_way);
for (var i=0; i<parsed.length; i++) {
parsed[i].your_field1_name_to_be_udpated = poLine.your_key1_name;
parsed[i].your_field2_name_to_be_udpated = poLine.your_key2_name;
parsed[i].your_field3_name_to_be_udpated = poLine.your_key3_name;
parsed[i].your_field4_name_to_be_udpated = poLine.your_key4_name;
parsed[i].your_field5_name_to_be_udpated = poLine.your_key5_name;
parsed[i].your_field6_name_to_be_udpated = poLine.your_key6_name;
parsed[i].your_field7_name_to_be_udpated = poLine.your_key7_name;
}
$scope.page.g_form.setValue('invoice_line_items_three_way', JSON.stringify(parsed));
};