Retrieve only visible variables from a record producer to update the HR Case description

Astik Thombare
Tera Sage

We have a record producer with multiple variables. There are numerous criteria based on user location, where some variables are either visible or not. I want to update the description of the HR Case with only those variables that are visible to the end user on the portal. I know there is g_form.isVisible(), but we are facing some issues with this method. Can anyone suggest the best alternative way to achieve this?

1 ACCEPTED SOLUTION

Astik Thombare
Tera Sage

We used g_form.getEditableFields() for this.

📌 This method returns an array of field names (comma-separated) that are not read-only, i.e., all fields visible and editable to the end user.

👉 So, we created an additional variable to store all these visible fields, and in the record producer script, we used that to dynamically update the Description field of the HR case.

✅ Just marking this as correct so it can be helpful to others in the community as well!

Thanks,
Astik T 😊💬

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@Astik Thombare 

this is not possible as the visibility etc works on UI but in server side you won't know this.

So this requirement is not possible.

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

Can't we retrieve variable values from the client side using an onSubmit client script, capture only those visible to the end user, and pass them to the server side via GlideAjax to update the HR Case description?

We have implemented this method successfully, but the issue we are facing is that it fails randomly for certain cases. Any insights or suggestions to make it more reliable would be greatly appreciated.

@Astik Thombare 

share the complete scripts

how are you determining if the variable is visible? are you storing that in some hidden variable and then using that in description field?

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

.