OpenFn / grassroot-soccer

Grassroot Soccer CommCare-Salesforce integrations
https://openfn.github.io/grassroot-soccer/
0 stars 0 forks source link

`upsertRiskVulnerabilityNewReferrals` job not properly upserting Risk Assessment objects #36

Closed daissatou2 closed 2 years ago

daissatou2 commented 2 years ago

Describe the bug

As discussed on the call, we made this change in the upsertRiskVulnerabilityNewReferrals job because I noticed that we are not upserting Risk Assessments even when they are present in the message. See this run and message for example.

But after making that change, we are now seeing this JSON parser error: https://www.openfn.org/projects/grs-integrations/runs/062062fd-35e8-732b-b080-f7b4562a8871

To Reproduce

  1. Here is a link to a failed run on OpenFn.org which is indicative of the bug: https://www.openfn.org/projects/grs-integrations/runs/062062fd-35e8-732b-b080-f7b4562a8871

expression.js

Link to the job itself in Github: https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/upsertRiskVulnerabilityNewReferrals.js

state.json

https://www.openfn.org/projects/grs-integrations/messages/061770a2-b9a9-70a8-8ff1-b1f0806a8609

{ "configuration": "GRS Salesforce Production", "data": "Data linked above" }

Expected behavior

The example message here should upsert both Risk Assessment and Newreferral objects, not just one.

To test/resolve

  1. After the desired output is working locally (from the CLI), please [push commits to master || open a pull request].
  2. [Please test the change on OpenFn.org by re-running this run (link) and confirming success.]
lakhassane commented 2 years ago

@daissatou2 can you link LP credentials to be able to test?

lakhassane commented 2 years ago

@daissatou2 there were a typo in one of the relationship. It was written as relationship('Site2__c', ...), instead of relationship('Site2__r', ...). When using relationship the field should mostly be ending with __r and not __c

It's corrected here: https://www.openfn.org/projects/grs-integrations/runs/062063a0-b1ad-7774-9773-972575f317f3