by Juan Leyva.
Hi,
via get_course_user_profiles you can obtain the list of roles for an existing user including the roleid and roleshortname, this should be help you to find the correct roleid for your role (based on the shortname).
Is not the best solution, but it seems the only way to do it right now
Definitively, that function should support role shortname instead role ids
Juan