Comments on: ‘Add Me’ UI macro for User and Group Fields https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 19:52:14 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Fern https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9231 Wed, 06 Oct 2021 00:57:28 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9231 This post has aged well. Confirming that it still works on Quebec.

]]>
By: Snehal Madakatti https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9228 Fri, 10 May 2019 05:26:22 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9228 Great post. Thanks a lot Mark.!…

]]>
By: Dave Edgar https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9226 Wed, 15 Nov 2017 16:28:52 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9226 Hey. I have used this to create button on a catalog item which works perfectly, apart from having to use a string field which has to show, but it doesn’t work on the portal. Any ideas:

function onLoad() {
//The variable name to put the icon next to
g_form.setReadOnly(‘u_ca’, true);
var varName = ‘u_ca’;

try{
//Add the icon decoration to the reference field
var varEl = g_form.getControl(varName).id;
$(varEl).insert({
after: ‘
});
//Add the ‘onclick’ event
$(‘icon-search’).observe(‘click’, checkAvailability);
}catch(e){}

function checkAvailability(){
//…the rest of my function code this button triggers
}
}
}

I’d guess it’s something to do with ‘sn-tooltip-basic’???

]]>
By: Kyle Wiley https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9225 Tue, 26 Sep 2017 19:03:24 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9225 Mark,

I followed your above steps for adding the macro to the Assigned to Field but I don’t get the icon. I tried it in my developer instance (Jakarta) and it worked just fine but in my org’s instance (Helsinki) the macro doesn’t show next to the Assigned to field.

Any ideas why this might be?

]]>
By: Mila Morales https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9224 Wed, 06 Sep 2017 19:23:09 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9224 In reply to Blair.

Jelly scripts are not working in service portal, as a workaround you can create a widget that will do the same function.

HTML Template:
<div id ="addme" ng-init="append()">
<button ng-click = "setVal()" type="button" class="btn btn-default" aria-label="Add me">
<span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add me
</button>
</div>

Client Script:
function($scope) {
/* widget controller */
var c = this; 
$scope.setVal = function(){
$scope.page.g_form.setValue('requested_for', c.data.userid);
} 
$scope.append = function(){
jQuery("#addme").appendTo("#INSERTSYSIDOFREFERENCEFIELDHERE");
} 
}

Server Script:
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.userid = gs.getUserID();
})();

You can then reference this in widget field of a macro type variable.

]]>
By: Blair https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9223 Wed, 30 Aug 2017 20:36:02 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9223 In reply to Troy.

Troy,

Do you know how to get this to work on the service catalog within the service portal?

]]>
By: Blair https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9222 Mon, 28 Aug 2017 18:45:27 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9222 Can this work on the Service Portal for the variables? The way we have it set up doesn’t work and before I try I wanted to see if it was even a possibility. Thanks.

]]>
By: Sandesh https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9221 Thu, 22 Jun 2017 10:19:48 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9221 just to add to that. it is not going inside the addme function as i have put an alert

]]>
By: Sandesh https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9220 Thu, 22 Jun 2017 08:14:15 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9220 Hi Mark, thanks for this post.
I have used this in assigned_to field to override in marketing request table and it is working fine with the group validation, the same attribute when i have overrided in marketing task table the validation doesn’t work and the assigned to poppulated with current user even though he is not the member of the group.
Can you please help on what could possibly be wrong. Its the same macro i am using.

]]>
By: Troy https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/#comment-9219 Mon, 03 Apr 2017 21:31:49 +0000 https://servicenowguru.wpengine.com/?p=4341#comment-9219 If others are searching for the list of icons available I found two pages that may prove helpful:

https://marcoceppi.github.io/bootstrap-glyphicons/ – the visual list

https://community.servicenow.com/message/1067279#1067279 – the text list of icons

Enjoy!

]]>