The CreatorCon Call for Content is officially open! Get started here.

Autopopulate the current user details in the catalog item form and empty field should be editable

saikirangd9
Giga Contributor
Hello I have been assigned to a task where the requirement as follows: I want to auto populate all the current login user details in catalog item and store them all in variable set and use it and if the current user doesn't have any details for example manager then make that variable editable in catalog form and others remaining fields should be read only.
1 ACCEPTED SOLUTION

YaswanthKurre
Tera Guru

Hi @saikirangd9 ,

 

This is a common requirement in ServiceNow Catalog Items — where you want to:

  • Auto-populate variables in a variable set with the currently logged-in user's details (e.g., name, email, department, manager).

  • Make these variables read-only, except for fields like manager, which should be editable if empty.

Steps:

  1. Create a Variable Set with user-related variables.

  2. Use a onLoad Catalog Client Script to:

    • Populate variables with g_user or a GlideAjax call.

    • Set them as read-only.

    • Make specific variables editable if no data exists.

Mark this as helpful and correct if this answers your question.

 

Thanks,

Yaswanth

View solution in original post

1 REPLY 1

YaswanthKurre
Tera Guru

Hi @saikirangd9 ,

 

This is a common requirement in ServiceNow Catalog Items — where you want to:

  • Auto-populate variables in a variable set with the currently logged-in user's details (e.g., name, email, department, manager).

  • Make these variables read-only, except for fields like manager, which should be editable if empty.

Steps:

  1. Create a Variable Set with user-related variables.

  2. Use a onLoad Catalog Client Script to:

    • Populate variables with g_user or a GlideAjax call.

    • Set them as read-only.

    • Make specific variables editable if no data exists.

Mark this as helpful and correct if this answers your question.

 

Thanks,

Yaswanth