From e6de5a11cba1591f8588797f37353eebbb8464b3 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 28 Aug 2015 16:47:42 -0400 Subject: [PATCH] APIExplorer - allow entering an id in entityRef --- templates/CRM/Admin/Page/APIExplorer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index b2aeb0877d..ffac1c3240 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -365,7 +365,14 @@ entity: entity, select: { multiple: multiSelect, - minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1 + minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1, + // If user types a numeric id, allow it as a choice + createSearchChoice: function(input) { + var match = /[1-9][0-9]*/.exec(input); + if (match && match[0] === input) { + return {id: input, label: input}; + } + } } }); } -- 2.25.1