Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.

save form before starting a process

mrbdrm

I have a Parent and Child BO
from the parent BO form i have a process that add a new child.
now the issue is: all the parent attributes values will reset to the default value .
is there a way to call AwareApp.recalculateObject(this) before calling a process?


BenHayat

mrbdrm wrote

from the parent BO form i have a process that add a new child.

I would not take this approach, because it's error prone and you can end up with orphan child record if user doesn't go through properly. I have this case many times and I had made a hard decision that user must first save parent record and then bring up the parent in edit mode and add children.

Also, how are you adding a process to a "Create" form? The Form Operation Menu is not available. And the reason it's not available, it's because of the reason I stated above.


customaware

Yes, I agree with Ben.

Unless I can create the child reference record using the built in Add New then I always actually CREATE the Parent first and then display.


BenHayat

eagles9999 wrote

Yes, I agree with Ben.

Unless I can create the child reference record using the built in Add New then I always actually CREATE the Parent first and then display.

I'd disable this right away to avoid this problem. Orphan records can create a lot of problems due to broken object graph chain.


mrbdrm

well first i create the parent and view it with a process, so the parent is already created.

now the way i create the child is with a process similar to the Photo Album sample application (with multiple Upload).
if i display the child reference in the parent form using Table of Items display. then i can use the built in Add new and it will work ok. but i am using display as custom and starting the process from panel menu.
then i must add the process to the list that refresh the parent form <--- this is where the trouble come in.
after the refresh all the parent attributes get reseted.


mrbdrm

Here is Before and After images to help demonstrate the case.
the process:

CREATE Attachments FOR EACH FileItem WITH Attachments.ForOL=ThisOL,Attachments.FileUp=FileItem.Doc

OL=Parent
Attachments=child

before.png

before.png

after.png

after.png


ACDC

I think you should try place a rule on the object that creates the child object
Eg: If MyObject IS NEW then CreateChildObject with ...


ACDC

i meant to say, its sometimes easier to let an object rule carry through with what you are trying to do with a Process Rule. You are always guaranteed of being in context and also can get quite creative by. For example you could add another rule on the child object IF ChildObject IS NEW then do something


mrbdrm

i don't think it's possible to save the form from object rules.
and as far as i know you can't implement multi file upload with rules.
i tried using

AwareApp.startProcessFromForm ('Upload', 'main', this, true)"

in the form and it saves the form but failed to start the process with this error in log.

log.png

log.png


ACDC

My comment was more related to the creation of the child object than the upload of the document action
When a rule on an object runs the object automatically updates so there is no need to force an UPDATE

If there is user interaction needed then you will have to do it in a Process,

If you describe again in layman terms what the application does in point form so I can get a better understanding of the objective I will try and help further


ACDC

Is there a user involved with the file upload ? must the user select the files ? or do the files reside on the server somewhere


mrbdrm

first the user create the parent (message) then if needed upload files to the child (attachments) from his computer.
I guess what I really need is auto update for the parent BO.

as a note this type of issues in awareim is always present if I choose to display reference attribute as: custom and trying to start a process from the reference attribute.

I appreciate your help with this matter 🙂


ACDC

So are you not able to to add your process button on the custom reference and then set the form to refresh when the process is run i.e. "form auto refresh settings" on the parent form


mrbdrm

Yes
The process start and the file is uploaded successfully then the form refresh after that all the other attributes of the parent BO values get reseted.