- 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 05:47 AM
hello
while setting you just need to set the entire json
LIKE BELOW
[{"field_1_label":"field_1_value" ,"field_2_label":"field_2_value"},
{"field_1_label":"field_1_value" , "field_2_label":"field_2_value"} ]
can you tell me whats coming in alert and what value you are trying to set
if you can post the script which will be helpful to debug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 07:16 AM
I am getting alerts . but the variable set is not getting auto populated . Upon entering the values in quantity the object should be pushed into variable set . I am not getting what s the mistake here.
html :
<td> <input type = 'text' maxlength="2" size="2" ng-model="poLine.quantity" ng-init="poLine.quantity=0" ng-change="fieldChange(poLine)" required ></td>
This is my client controller script
$scope.fieldChange = function(poLine) {
var oDetails = [];
oDetails.push(poLine);
var details = {
"total_rows": 1,
"invoice_line_items": oDetails
};
var three_way = $scope.page.g_form.getField("invoice_line_items");
alert(JSON.stringify(details));
for (var sKey in details) {
if (sKey == "invoice_line_items") {
$scope.page.g_form.setValue(sKey, details[sKey]); /
}
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 07:21 AM
hello
okay can you send the screenshot of your MVRS ?
may be i can tell you the json that needs to be pushed after seeing it
are these JSON elements fields of mvrs ?
var details = {
"total_rows": 1,
"invoice_line_items": oDetails
};
TOTAL ROWS --> field one in MVRS
Invoice line items -->Second field in MVRS (assuming to be a list collector ?)
please post the screenshot of MVRS once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2022 07:41 AM
Sorry my miss this is the edited script. the below is the screenshot of the variable set.
$scope.fieldChange = function(poLine) {
var three_way = $scope.page.g_form.getField("invoice_line_items_three_way");// variable set
for (var sKey in poLine) {
$scope.page.g_form.setValue(sKey, poLine[sKey]);
}
};