Record producer: Issues with autopopulate assignment groups, category and subcategory fields

Yamlet8
Giga Expert

Hi so I'm trying to autopopulate the sub category and assignment group as well as the category based on producer subcategory. As i try to define the set value, im being met with error

any help this is for a client script

 

function onSubmit() {
    var gr1 = new GlideRecord('sys_user_group');
    gr1.addQuery('name', <group name>);
<10+ group name queries for gr.1>
    gr1.query();
    if (gr1.next()) {  //hopefully as the producer populates the incident ticket it populates the below information
//need a replacement for specification when setting group instead of set value
  try {
            if (g_form.getValue(producer.problem_subcategory) == '<sub cat name>') {
                g_form.setValue(current.assignment_group, '<group name>');

            }
        } catch (err) {
            g_form.addErrorMessage("A runtime error occured: 2 " + err);
        }
<5+ try/catch to pinpoint the producer sub category and assign group >
5 REPLIES 5

Community Alums
Not applicable

Hi Yamlet,

 

You should not be using g_form object as it is a client side object as mentioned in above comment. 

Now, if you are trying to populate values on the form, you should be using 'OnChange' type of client script.

If you want to populate a field in the backend you can use Record Producer script (server script).

 

If you still have questions, please let us know your exact requirement and we will be able to provide more accurate answer.

 

Please mark this comment as Correct Answer/Helpful if it helped you.

 

Cheers,

Hardit Singh