can i add related list from client script

tshk
Giga Contributor

On incident if i assign it to a specific group i should add the a incident_task related list, is it possible and if so how?

1 ACCEPTED SOLUTION

tanuja8
Giga Contributor

Hello Hari,



You cannot add anything on form through client script, Infact can only show/hide fields, sections, related lists that have already added.


So add the required related list through form layout and show/hide the related list with below methods in the OnChange client script as per the required conditions.



g_form.showRelatedList("related_list_table_name");


g_form.hideRelatedList("related_list_table_name");



Thanks,


Tanuja


View solution in original post

4 REPLIES 4

Dylan Mann1
Giga Guru

What if you set an ACL where only members of that group can edit or read that list? Give me a like if this helped!


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Hari,



So I assume you want following:


1) User populates assignment group on incident and saves the record then it should create a record in incident_task table



you can have after update business rule and have condition as assignment group is not empty and create record through script in incident_task table.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

tanuja8
Giga Contributor

Hello Hari,



You cannot add anything on form through client script, Infact can only show/hide fields, sections, related lists that have already added.


So add the required related list through form layout and show/hide the related list with below methods in the OnChange client script as per the required conditions.



g_form.showRelatedList("related_list_table_name");


g_form.hideRelatedList("related_list_table_name");



Thanks,


Tanuja


tshk
Giga Contributor

Thanks for the reply guys,



I'm also interested to know how i can make the related list mandatory when i show it?