When we use current. and when g_form ?

Vinay Nimbalka1
Kilo Contributor

we can access the form variable using both "current" and "g_form" but what is the specific area of both? 

1 ACCEPTED SOLUTION

Ajaykumar1
Tera Guru

Hi,

current object is used to refer the currently opened record on a business rule, workflows and in some other server-side scripts.

The current object is automatically instantiated from the GlideRecord class. The current object's properties are all the fields for a record and all the GlideRecord methods. The property values are the values as they exist in the runtime environment.

It's a reference to the record you are in. Example. An Incident record.

On the other hand, g_form is an object of GlideForm class, it is used to access the currently opened form data.

The GlideForm client-side API provides methods for managing form and form fields, such as,

  • Retrieve a field value on a form
  • Hide a field
  • Make a field read-only
  • Write a message on a form or a field
  • Add options to a choice list
  • Remove options from a choice list

For more information refer below links.

The GlideForm (g_form) Class

current and previous

Mark If Correct/Helpful.

Regards,
Ajay

View solution in original post

5 REPLIES 5

Ajaykumar1
Tera Guru

Hi,

If your issue is resolved, please mark the appropriate answer as correct and remove the thread from the unanswered queue.

Thanks.

Regards,
Ajay