hiding additional comments on portal

kali
Tera Contributor

Hi All, Please help me to achieve the below ones

1) I want to hide additional comments on portal when a particular state is selected .

2) I have to capture a field change on agent workspace and display it on the portal(Note: Any other solution other than the info fields) .

 

Thanks in advance

1 REPLY 1

J_31
Kilo Sage
  1. To hide additional comments on the portal when a particular state is selected, you can add a client script on the portal page that checks the value of the state field and hides the additional comments field accordingly. Here's an example script:
    javascript

    function onLoad() {
    var stateField = g_form.getReference('state');
    if (stateField.getValue() == 'Closed') {
    // hide additional comments field
    g_form.setDisplay('additional_comments', false);
    }
    }
    This script hides the additional comments field if the state field's value is "Closed". You can customize the condition as per your requirements.

    To capture a field change on agent workspace and display it on the portal, you can create a business rule that runs on the field change event and updates a field in a related record. Then, you can use a UI action or client script on the portal to display the updated field value.
    Here's an example business rule:


    Name: Update Field on Change
    Table: Incident
    When: After
    Insert: false
    Update: true
    Condition: Change fields condition
    Fields: the field you want to monitor for changes
    This rule will trigger on the field change event and update a field in the incident record. You can customize the condition and fields as per your requirements.

    Next, you can create a UI action or client script on the portal to display the updated field value. Here's an example client script:


    function onLoad() {
    var incidentId = g_form.getUniqueValue();
    var gr = new GlideRecord('incident');
    gr.get(incidentId);
    var updatedField = gr.getValue('updated_field');
    // display updated field value
    alert('Field updated to: ' + updatedField);
    }
    This script retrieves the incident record on the portal page and displays the value of the updated field in an alert box. You can customize the script to display the updated field value in any other way as per your requirements.