{"id":56,"date":"2012-07-30T05:13:00","date_gmt":"2012-07-29T23:43:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=56"},"modified":"2012-07-30T05:13:00","modified_gmt":"2012-07-29T23:43:00","slug":"how-to-get-all-the-selected-records-id-for-the-bulk-edit-form","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2012\/07\/how-to-get-all-the-selected-records-id-for-the-bulk-edit-form\/","title":{"rendered":"How to get all the selected records id for the bulk edit form"},"content":{"rendered":"<div dir=\"ltr\" trbidi=\"on\">Further to one of our previous <a href=\"http:\/\/inogic.blogspot.in\/2011\/10\/enable-scripts-on-bulk-edit-form-in-crm.html\" target=\"_blank\" rel=\"noopener noreferrer\">blog spot<\/a><\/p>\n<p>We can write scripts on bulk edit form to check that the entered field value is unique for the selected group of records. If the value is duplicate then the user should get an alert and the bulk edit form should be closed. <\/p>\n<p>To achieve this, we need to retrieve all the records and compare the new value with the existing values. <\/p>\n<p>But to retrieve we require the ids of all the selected records for bulk edit. To get ID we normally use <\/p>\n<p><strong>Xrm.Page.data.entity.getId() <\/strong><\/p>\n<p>But this will not give us the id of all the selected records. To get ids of all selected records we need to use a window command <strong>window.dialogArguments. <\/strong><\/p>\n<p>\u00a0\/\/check whether the form is bulk edit form <\/p>\n<p>\u00a0var formType = Xrm.Page.ui.getFormType(); <\/p>\n<p>if (formType == 6) <br \/>{ <\/p>\n<p>\u00a0\/\/Read ids from dialog arguments <\/p>\n<p>\u00a0var records = window.dialogArguments; <\/p>\n<p>\u00a0for(i=0; i<records.lenght;i++)<br \/>\u00a0{ <br \/>\u00a0 \u00a0alert(records[i]); <br \/>\u00a0} <br \/>} <\/p>\n<p>Hope this helps and is useful!!<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Further to one of our previous blog spot We can write scripts on bulk edit form to check that the entered field value is unique for the selected group of records. If the value is duplicate then the user should get an alert and the bulk edit form should be closed. To achieve this, we\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2012\/07\/how-to-get-all-the-selected-records-id-for-the-bulk-edit-form\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[20,21,22,24],"tags":[221,877,1570],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm-2011","category-dynamics-crm-2013","category-dynamics-crm-2015","category-dynamics-crm-2016","tag-bulk-edit","tag-guid","tag-selected-records"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}