How to prompt a List type field to the user in Service Operation Workspace

Alon Grod
Tera Expert

Hi,

This script will prompt the user with a string field. Is there any way to do the same just with a List type field reference to sys_user_group table?

function onClick(g_form) {
    g_modal.showFields({
        title: "Enter your reason",
        fields: [{
            type: 'textarea',
            name: 'work_notes',
            label: getMessage('Reason'),
            mandatory: true
        }],
        size: 'lg'
    }).then(function(fieldValues) {
        g_form.setValue('work_notes', fieldValues.updatedFields[0].value);
        g_form.save();
    });
}


Result of above script:

find_real_file.png

 


 

1 ACCEPTED SOLUTION

Najmuddin Mohd
Mega Sage

Hi @Alon Grod ,

It's done.

NajmuddinMohd_0-1724001236294.png

 

function onClick(g_form) {

    var fields = [
        
        {
            type: 'glide_list',
            name: 'watch_list',  
            label: getMessage('Add groups'),
            mandatory: true,
            reference: 'sys_user_group',
            referringTable: 'incident',
            referringRecordId: g_form.getUniqueValue(),
            value: g_form.getValue('watch_list'),
            displayValue: g_form.getDisplayValue('watch_list')
        }
    ];

    g_modal.showFields({
        title: "Groups",
        fields: fields,
        size: 'lg'
    }).then(function(fieldValues) {
        
        g_form.setValue('watch_list', fieldValues.updatedFields[0].displayValue);
        g_form.save();
    });
}

 

Replace watch_list with the field that is used to map.
Replace incident with the table on which the filed is created.

 

Or, if you want to first try the above code, convert Watch list on the incident form from Reference to List type.
Steps: Configure dictionary on the Watch list, Change type from Reference to List and save the form.

If this information helps you, mark this post as Helpful and Accept the solution.

Regards,
Najmuddin.

 

View solution in original post

2 REPLIES 2

Najmuddin Mohd
Mega Sage

Hi @Alon Grod ,

It's done.

NajmuddinMohd_0-1724001236294.png

 

function onClick(g_form) {

    var fields = [
        
        {
            type: 'glide_list',
            name: 'watch_list',  
            label: getMessage('Add groups'),
            mandatory: true,
            reference: 'sys_user_group',
            referringTable: 'incident',
            referringRecordId: g_form.getUniqueValue(),
            value: g_form.getValue('watch_list'),
            displayValue: g_form.getDisplayValue('watch_list')
        }
    ];

    g_modal.showFields({
        title: "Groups",
        fields: fields,
        size: 'lg'
    }).then(function(fieldValues) {
        
        g_form.setValue('watch_list', fieldValues.updatedFields[0].displayValue);
        g_form.save();
    });
}

 

Replace watch_list with the field that is used to map.
Replace incident with the table on which the filed is created.

 

Or, if you want to first try the above code, convert Watch list on the incident form from Reference to List type.
Steps: Configure dictionary on the Watch list, Change type from Reference to List and save the form.

If this information helps you, mark this post as Helpful and Accept the solution.

Regards,
Najmuddin.

 

Hello @Alon Grod ,
Did the above information helped you.

If yes, please mark the above post as Helpful and Accept the solution.

Regards,
Najmuddin.