Submitted form is not getting resolved

Hi @All

When i am submitting a form the form is still showing up. Can someone please help.
Scenario:
1.National user submits a action test result form which will trigger a task to regional user.
2.In Regional user task . I am filtering the reports with unique alert id and getting the district id details and fetching it through my task form.
3.In Regional user task i added a addition doc(db-doc) and passing all the values details and filtered district_id in place_id.
4.Upon submitting the Regional user task a additional doc is created and district user task got triggered but the form is still showing up on UI.

Can someone help me to fix the above issue.

Hi @bindugowrig, could you paste a code snippet of the task you are working on? It would help in trying to debug the issue.

@samuel , Thanks for pitching in

Here is the code snippet

{
name: ‘task_national_test_result_reg’,
icon: ‘Icon-result-form’,
title: ‘Information Résultat Test’,
appliesTo: ‘reports’,
appliesToType: [‘action_test_result_national’],
appliesIf: (contact, report) => {

        return getField(report, 'results.result') === 'Oui' &&
            user.parent.contact_type ==='rspis_region';
    },
    contactLabel: (contact, report) =>{
        return getField(report, 'place_name' );
    },
    resolvedIf: function (contact, report, event, dueDate){
        
        return isFormArraySubmittedInWindow(contact.reports, ['test_result_additional_doc'],
            dueDate, event, null, report._id);
    },
    actions: [{
        type: 'report',
        form: 'test_result_notification_region',
        label: 'task.test_result_notification_region.label',
        modifyContent: function (content, contact, report){
            const s_gen_alert_id = getField(report, 'patient_info.patient');
            const recordAll = contact.reports.filter(elem => elem.form === 'task_enregistrement' );
            const matchedRecord = recordAll.filter(r=>getField(r, 's_gen_alert_id') === s_gen_alert_id);
            content.district_uuid = getField(matchedRecord[0], 'd_contactparent_id');
            console.log(content.district_uuid);
        }
    }],
    events: [
        {
            id: 'alert_reminder_1',
            days: 0,
            start: 0,
            end: 3
        }
    ],
},

Thanks, @bindugowrig . This issue is likely in the resolvedIf . If you could get that function working as expected, it will probably solve it.

Let me know if you are able to get the function to work. Happy to follow up and help along the way.

@bindugowrig

What’s your definition of isFormArraySubmittedInWindow? Are you able to attach the code?

cht-nootils, which is accessible from the Utils object has isFormSubmittedInWindow (only works with a single form) that can be used to troubleshoot where your implementation my have an issue.

Note: you would need to add Utils to your globals section in .eslintrc

Hi @samuel , @derick the above issue got fixed when i passed both the actual form and the additional doc form in resolved if and updating the place id in regional and addition_doc forms

1 Like