Adding virtual field for showing STATICLIST

The client would like to display the static list containing details. We have developed a virtual field and shown the details to the list.

 if (scriptContext.type == ‘view’) {

                    let customTab = scriptContext.form.addTab({

                        id: ‘custpage_custom_notes’,

                        label: ‘Custom Notes’

                    });

                    let sublist1 = scriptContext.form.addSublist({

                        id: ‘custpage_my_sublist’,

                        label: ‘My Sublist Label’,

                        type: serverWidget.SublistType.STATICLIST,

                        tab: ‘custpage_custom_notes’

                    });

                    sublist1.addField({

                        id: ‘custpage_datetime’,

                        label: ‘DATE’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_setby’,

                        label: ‘SET BY’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_context’,

                        label: ‘CONTEXT’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_type’,

                        label: ‘TYPE’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_field’,

                        label: ‘FIELD’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_oldvalue’,

                        label: ‘OLD VALUE’,

                        type: serverWidget.FieldType.TEXT

                    });

                    sublist1.addField({

                        id: ‘custpage_newvalue’,

                        label: ‘NEW VALUE’,

                        type: serverWidget.FieldType.TEXT

                    });

// fetch the details that needs to be displayed in the field

if (date) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_datetime’,

                                        line: index,

                                        value: date ||

                                    });

                                }

                                if (setBy) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_setby’,

                                        line: index,

                                        value: setBy ||

                                    });

                                }

                                if (context) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_context’,

                                        line: index,

                                        value: context ||

                                    });

                                }

                                if (type) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_type’,

                                        line: index,

                                        value: type ||

                                    });

                                }

                                if (field) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_field’,

                                        line: index,

                                        value: field ||

                                    });

                                }

                                if (oldValue) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_oldvalue’,

                                        line: index,

                                        value: oldValue ||

                                    });

                                }

                                if (newValue) {

                                    sublist1.setSublistValue({

                                        id: ‘custpage_newvalue’,

                                        line: index,

                                        value: newValue ||

                                    });

                                }

}

Leave a comment

Your email address will not be published. Required fields are marked *