How to set_value a checkbox that is inside the HTML type field?

Frappe core doctype User have a fieldname roles_html which store the roles.


i want to tick the checkbox by using cur_frm.set_value(‘roles_html’, 1);

i tried using jQuery but it didnt tick the checkbox:
let ps_user = $("div[data-fieldname='roles_html'] div div[data-user-role='Accounts Commission User'] input[type='checkbox']"))

cur_frm.set_value(ps_user['roles_html'], 1)

Any idea?

Hi @SinChan4896,

Why do this?
If you want to add a role in user roles_html then create a new Role and save it.

Then reload and check in the user role list.

I hope this helps.
Thank You!

I need to create many User each time, so I try to do it on automation instead of manually check the checkbox for roles_html where each time I will auto generate a new user with bundle of role in roles_html

Let say a new user is created with the name of Supplier Jojo
it should ticked the roles_html ['Supplier', 'Stock User', 'Sales User']


Look at Role Profile.