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

@Astik Thombare 

did you debug the client script and script include?

what does that script include function do in server side?

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

.

@Astik Thombare 

Did you get a chance to check on my above response?

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Astik Thombare 

if the variable has value in it, it means it was visible -> this much you can do and based on that you can determine and print that in description

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

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 😊💬