Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

is my script include and client script is correct or not to get the user full name in description

srilekhac
Tera Contributor
var GetUserFullName = Class.create();
GetUserFullName.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    initialize: function() {
},
getFullName: function() {
        var user = gs.getUser();
        var fullname = user.getFirstName() + " " + user.getLastName();

        gs.log("Full name retrieved: " + fullname, "GetUserFullName");
        return fullname;
    },

    type: 'GetUserFullName'
});
7 REPLIES 7

Hello @srilekhac 

 

I believe you are doing great.

Did my reply answer your question?


If my response helped, please mark it correct and close the thread so that it benefits future readers.

 

Thanks & Regards
Viraj Hudlikar

Laveena_A
Tera Expert

Hi @srilekhac 

 

You can skip this route to get the name from script include, alternatively follow this approach:-

In client script, you can simply use-

g_form.getFullName()

 

In Business Rule, use-

gs.getUser().getFullName();

 

Marked the solution as Helpful and Correct, if it works for you!

Laveena_A
Tera Expert

Hi @srilekhac 

You can utilize following methods to fetch the full name of current logged in user-

 

In Business Rule or server side scripting - 

gs.getUser().getFullName()
In client script - 
g_form.getFullName()