Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

HR Agent Workspace – Close Notes not visible when using Close Complete Button

fasiham13180808
Tera Contributor

Hi Everyone,

I am facing an issue in HR Agent Workspace with the Close Complete action on sn_hr_core_case_payroll.

Requirement:

When State = Close Complete (3):

  • Close Notes should become visible

  • Close Notes should be mandatory

  • Case should not close if Close Notes is empty

What I Have Done:

Data Policy

  • Made Close Notes mandatory when State = Close Complete

  • Issue: Data Policy throws error before the field becomes visible in Workspace

UI Policy

  • Condition: State = Close Complete

  • Action: Show + Mandatory Close Notes

  • Issue: UI Policy does not trigger in HR Agent Workspace

Current Situation:
But UI Policy is client-side and Data Policy is server-side. Before the field becomes visible, Data Policy throws an error, so it says “fill Close Notes” but the field is not visible. I even tried a Business Rule, but the same happens—the field is still not visible because the Close Complete button in Workspace works server-side. That’s why this issue occurs.


Observed Behavior:

  • Clicking Close Complete does not visually change the state before submit

  • Validation runs server-side

  • UI Policies do not trigger

  • Close Notes field remains hidden

Question:

What is the recommended approach in HR Agent Workspace to:

  • Show Close Notes when Close Complete is clicked

  • Make it mandatory before submission

  • Ensure proper UX without relying on Data Policy

Should this be handled via:

  • Workspace Client Script?

  • Customizing the Close Complete UI Action?

  • Or another supported approach?

Any guidance would be appreciated.

Thank you!

 

1 ACCEPTED SOLUTION

Shruti
Giga Sage

Hi

1. Create a  custom Ui action on payroll case table

Condition - current.state==18 && !current.sla_suspended && new hr_Delegation().isAssignedOrDelegated(current) && !new hr_CoreUtils().hasOpenTasks() && !new hr_Utils().hasApprovalPending(current)

 

Script - 

if (typeof window == 'undefined') {
    var CLOSED_COMPLETE = 3;
    var AWAITING_ACCEPTANCE = 20;

    if (current.skip_automatic_user_acceptance_state)
        current.state = CLOSED_COMPLETE;
    else {
        current.sla_suspended = true;
        current.sla_suspended_on = new GlideDateTime().getDisplayValue();
        current.state = AWAITING_ACCEPTANCE;
    }


    current.update();
    action.setRedirectURL(current);
}
 
 
Workspace client script 
function onClick(g_form) {
    askConfirmation(g_form);

}
function askConfirmation(g_form) {
    var fields = [{
        type: 'textarea',
        name: 'close_notes',
        label: getMessage('Close notes'),
        mandatory: true
    }];

    g_modal.showFields({
        title: getMessage('Please enter close notes.'),
        fields: fields,
        cancelTitle: getMessage('Cancel'),
        confirmTitle: getMessage('Submit'),
        size: 'md',
        cancelType: "default",
        confirmType: "confirm"
    }).then(function(fieldValues) {
        g_form.setValue('close_notes',  fieldValues.updatedFields["0"].stagedValue);
        g_form.submit('close_complete_payroll');
       
    });
}

 

2. Navigate to Declarative action -> Form actions 

Open close complete button on HR case table and go to the related list Action Exclusion

Create a new entry to exclude payroll case table

View solution in original post

3 REPLIES 3

Shruti
Giga Sage

Hi

1. Create a  custom Ui action on payroll case table

Condition - current.state==18 && !current.sla_suspended && new hr_Delegation().isAssignedOrDelegated(current) && !new hr_CoreUtils().hasOpenTasks() && !new hr_Utils().hasApprovalPending(current)

 

Script - 

if (typeof window == 'undefined') {
    var CLOSED_COMPLETE = 3;
    var AWAITING_ACCEPTANCE = 20;

    if (current.skip_automatic_user_acceptance_state)
        current.state = CLOSED_COMPLETE;
    else {
        current.sla_suspended = true;
        current.sla_suspended_on = new GlideDateTime().getDisplayValue();
        current.state = AWAITING_ACCEPTANCE;
    }


    current.update();
    action.setRedirectURL(current);
}
 
 
Workspace client script 
function onClick(g_form) {
    askConfirmation(g_form);

}
function askConfirmation(g_form) {
    var fields = [{
        type: 'textarea',
        name: 'close_notes',
        label: getMessage('Close notes'),
        mandatory: true
    }];

    g_modal.showFields({
        title: getMessage('Please enter close notes.'),
        fields: fields,
        cancelTitle: getMessage('Cancel'),
        confirmTitle: getMessage('Submit'),
        size: 'md',
        cancelType: "default",
        confirmType: "confirm"
    }).then(function(fieldValues) {
        g_form.setValue('close_notes',  fieldValues.updatedFields["0"].stagedValue);
        g_form.submit('close_complete_payroll');
       
    });
}

 

2. Navigate to Declarative action -> Form actions 

Open close complete button on HR case table and go to the related list Action Exclusion

Create a new entry to exclude payroll case table

Hi @Shruti  ,
Thankyou for your reply but in related list Action Exclusion there is no option of payroll table

fasiham13180808_0-1771961844480.png

 

 

Make sure you are in same scope as HR payroll case table scope