- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 02:48 AM
I have 2 feilds in multi row variable set.I want to fetch the row count of tat variable set on submit of the multi row variable and display the row **bleep** in alert.
please guide me for this.
解決済! 解決策の投稿を見る。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 08:17 AM
You need to create this onsubmit client script on catalog item (Not on variable set client scripts) as mentioned below:
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 04:20 AM
Hi @ServicenowDev19 ,
You can use the following code:
function onSubmit() {
// Get the variable set using its sys_id
var variableSetSysId = g_form.getControl('variable_set').value;
var gr = new GlideRecord('item_option_new');
gr.addQuery('variable_set', variableSetSysId);
gr.query();
// Get the number of rows in the variable set
var rowCount = 0;
while (gr.next()) {
rowCount++;
}
// Display the row count in an alert
alert('Number of rows: ' + rowCount);
// Return true to continue with form submission
return true;
}
If my response helps you to resolve the issue close the question by ✅Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.
Thanks,
Ratnakar
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 08:13 AM
Hiii Ratnakar i am geeting row count , i want the record count.
Plz guide me for this.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 06:06 AM
Hii Ratnakar,
I am getting the row count , i want the record count .How to do that?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-25-2023 06:50 AM
If you want to check number of rows in the MVRS, here is the script:
var mvrsData = g_form.getValue('mvrs_internal_name'); //backend name of mvrs
var obj = JSON.parse(mvrsData);
var length = obj.length;
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.