Function object creation working in preview but not workshop

Hi there,

I have a function (shown below) that creates 1 object in object type reportLevelQAT and then multiple objects in object type answersQAT. When testing the function in the functions preview in code repository, it successfully does as expected but when I load it as an action into my workshop app, it does not work (only creates the single object in reportLevelQAT).

Do you have any recommendations as to why this is and how to resolve it?

Thank you!

@Edits(ReportLevelQAT, AnswersQAT)
    @OntologyEditFunction()
    public async CreateQuestionObjects(auditType: string, roleSelected: string, areaName: string, currentUserId: string): Promise<void> {

        // Create report level object
        const newReport = Objects.create().reportLevelQAT(Uuid.random());
        newReport.DepartmentName = areaName;
        newReport.roleType = roleSelected;
        newReport.inspectionName = auditType;
        newReport.inspectorID = currentUserId;
        newReport.submitTime = Timestamp.now();

        // Identify all questions to be answered in the report
        const requiredQuestions = await Objects.search()
            .questionSetQAT() 
            .filter(i => i.inspectionName.exactMatch(auditType))
            .allAsync();

        // Create question level objects to be modified during inspection completion
        for (const requiredQuestion of requiredQuestions) {
            const QuestionAnswer = Objects.create().answersQAT(Uuid.random());
            QuestionAnswer.questionId = requiredQuestion.questionId;
            QuestionAnswer.questionText = requiredQuestion.questionText;
            QuestionAnswer.reportId = newReport.reportId;
            QuestionAnswer.submitTime = Timestamp.now();

        }
}

If I understand the Palantir documentation correctly, creating new objects/edits and trying to access these objects/edits in the same function simultaneously may lead to unexpected results.
They have stated it in the caveats here
I also faced similar issue and just using Edits decorator did not solve the issue for me.
What could help in your case would be separating these two functionalities in two different functions or chaining actions or the best according to me would be the use of “Automation” functionality on the object type where you can trigger the automation when reportLevelQAT objects are edited to call a separate action backed by a separate function that creates answersQAT objects.

Hope it helps!!!