- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 07:57 PM
Hi all,
Need your help in what could be wrong in the below code.
the expected result is when assignment group gets changed the assigned_to field value should be updated with a random person from the group however im not getting the result.
Appreciate your help.
SI:
Please consider only assignMembers function
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 11:59 PM
Thanks, as you can see, there is an error. Cannot read properties of null (reading length). Also before that error you can see null was logged, so member is null. Looking at your GlideAjax call again, you need to use sysparm_name when specifying the method to call, not just sysparm:
ga.addParam('sysparm_name', 'assignMembers'); // update this to be 'sysparm_name' instead of just 'sysparm'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 09:11 PM
Can you confirm if your code is going into the first if-statement block? Were you seeing the info messages at all or not?
Can you also confirm that if you check your browser console, do you see any errors?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 09:34 PM
The code is not going through the if block, ive added an infomsg outside the if and its working.
Also there were no errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 09:41 PM
i've added an infomsg just outside the if but the value of member is not displaying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 09:59 PM - edited 05-29-2024 09:59 PM
Can you instead do console.log(member) and see what your browser console shows? Consoles have the ability to log objects/arrays, whereas addInfoMesssage struggles with doing that (since it needs to print your array/object as a string).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:12 PM