Hey there!
I've been working on kind of a personal project with MAF; in a nutshell I've been trying to add a "surveys" page to the "Self Serve" application. I've already configured my own custom survey logic on Manage and it's working perfectly, and so far I've kind of configured a big chunk of it on self serve:
- I added a card group including my open surveys
- Clicking on any of these surveys routes me to a new page called "surveys" that lists my answers neatly
- Each answer has either star ratings, yes or no answers or a free form answer.
- Finally, there's a "submit button".
All that has been configured visually, but my problem here is that, all of it can not be mutated from the self serve portal. I mean I can click on the star rating, and it functions as you'd expect, but it doesn't save to the Manage database, even thought I am using maximo-datasource which theoretically should autosave. I do click on the submit button which calls an API and that API does run, but I am unable to save any changes in he data of the maximo-datasource.
I am using nested datasources, as well as not using any kind of controller for these datasource. Could this be the issue here? Is there some sort of guide I could be referencing regarding using datasources? I have read the MAF developer documentation but I am unable to extract the information I need from it.
Here's the relevant snippet from my code for reference:
<maximo-datasource id="surveyresponse" object-structure="MYSURVEYS" pre-load="true" where="surveyresponseid={page.params.surveyresponseid}" selection-mode="none" auto-save="true">
<schema id="a1_asdga8j5">
<attribute name="surveyresponseid" searchable="true" title="Response ID" unique-id="true" id="a1_amzasd8x"/>
<attribute name="description" searchable="true" title="Description" id="a1_asdqwngjs"/>
<attribute name="responder" searchable="true" title="Responder" id="a1_asdqwngj"/>
<attribute name="creationdate" searchable="true" title="Creation Date" id="a1_rgxasdnz"/>
<attribute name="status" searchable="true" title="Status" id="a1_anasd78w"/>
<attribute name="completiondate" searchable="true" title="Completion Date" id="a1_qasdnmp9"/>
<attribute name="recordid" searchable="true" title="Record ID" id="a1_asdqnasmp9"/>
<attribute name="ticket" id="a1_axw3asdj">
<attribute name="ticketid" searchable="true" title="Ticket ID" unique-id="true" id="asdf1_asdje9n5"/>
<attribute name="description" searchable="true" title="Description" id="aasd1_jwsdf3vk"/>
</attribute>
<attribute name="rel.surveyanswer{surveyanswerid, question, answer, order, mandatory, weight, description, type}" id="a1_p2yyz"/>
</schema>
<!-- <maximo-datasource id="surveyanswer" relationship="SURVEYANSWER" selection-mode="none">
<schema id="a1_j46rz">
<attribute name="*" searchable="true" title=" " unique-id="true" id="a1_ymk7_"/>
<attribute name="rel.ANSWERCHOICES{answer, description, weight}" id="a1_j49e8"/>
</schema>
</maximo-datasource> -->
</maximo-datasource>
<box id="a1_b2r58" direction="column">
<label label="Description: {surveyresponse.item.description}" id="a1_rbdev"/>
<data-list id="a1_qzmr_" datasource="{surveyresponse.item.surveyanswer}" no-select-behavior="true" hide-single-select-icon="true" show-search="false" show-single-select-icon="false">
<button on-click="submitSurveyResponse" on-click-arg="{surveyresponse}" label="Submit" id="a1_vwn6r" slot="actions"/>
<button on-click="saveResponse" on-click-arg="{surveyresponse}" label="Save" id="a1_vwnds6r" slot="actions"/>
<adaptive-row slot="item" id="a1_p3z3b">
<adaptive-column large-width="5" medium-width="5" small-width="5" xlarge-width="5" id="a1_drejk">
<box fill-parent-vertical="true" vertical-align="center" id="a1_n6v6a">
<label label="{item.order}" id="a1_q2s5w3"/>
</box>
</adaptive-column>
<adaptive-column large-width="60" medium-width="60" small-width="60" xlarge-width="60" id="a1_vx937">
<box fill-parent-vertical="true" vertical-align="center" id="a1_ejr53">
<label label="{item.question}" id="a1_sq2s5w3"/>
<label label="{item.answer}" id="a1_sq2s5ew3"/>
</box>
</adaptive-column>
<adaptive-column large-width="35" medium-width="35" small-width="35" xlarge-width="35" id="a1_wyarq">
<rating empty-color="grey" fill-color="Orange" maximum="5" value="{item.answer}" id="a1_maryj" hidden="{item.type != 'RATING'}"/>
<smart-input value="{item.answer}" label="Answer" id="a1_e5762" hidden="{item.type != 'FREEFORM'}"/>
<box hidden="{item.type != 'YN'}" id="a1_xavkn">
<button label="Yes" on-click="selectYes" on-click-arg="{item}" id="a1_rd79n"/>
<button label="No" on-click="selectNo" on-click-arg="{item}" id="a1_pjex2"/>
</box>
</adaptive-column>
</adaptive-row>
</data-list>
</box>