In an Approve button for a response-to-response form Action button, I have the following:
FIELD StatusProcess := "Approved";
FIELD ApproveProcess := @Name([CN]; @UserName);
FIELD ApproveProcessDate := @Now;
@SetDocField($REF; "Status"; "Completed");
@SetDocField($Ref; "ActivityDate"; @Today);
@Prompt([Ok]; "Approve Calibration Report"; "The Calibration Report was approved successfully and the Planter was updated to 'Completed' status.");
@Command([FileSave]);
@Command([CloseWindow])
Neither of the @SetDocField commands does anything. The parent (a response doc) is not updated. I tested @SetDocField in a response document and it does nothing to the parent (main doc). It appears @SetDocField is not working in 12.0.2FP4
Just add a computed field "Ref" with computed value @Text($Ref) in your response to response form. When you create a response to the response document, this field should get populated with the unid of the parent document if it is indeed a response document . if that happens, the updating of fields in parent document via setdocfield should work.
Have tested with domino v 12.0.02 FP2 (not FP 4). The parent document should have been saved atleast once before you create a response document though.
Im sure the response to response document is indeed being created as response to the response document as intended as they would be showing as responses in your view.
If this issue is sepecific to fp 4 upwards, need to raise it to hcl as a case.
Regards
The response-to-response was previously submitted, so it was a saved document. Inserting an @Prompt returned the UNID of the parent.
Hi Don Deal,
Good Day!
We sincerely apologize for the inconvenience caused by the code. We truly appreciate you providing detailed information and sharing the code with us—it greatly helped us in understanding the issue.
We made a slight modification to your formula in the last line.
FIELD StatusProcess := "Approved";
FIELD ApproveProcess := @Name([CN]; @UserName);
FIELD ApproveProcessDate := @Now;
@SetDocField($REF; "Status"; "Completed");
@SetDocField($Ref; "ActivityDate"; @Today);
@Prompt([Ok]; "Approve Calibration Report"; "The Calibration Report was approved successfully and the Planter was updated to 'Completed' status.");
@Command([FileSave]);
@Command([CloseWindow]) <--@Command([FileCloseWindow])
We kindly request you to refer to the following product documentation for the relevant formula
Title : @Prompt (Formula Language)
URL --> https://help.hcl-software.com/dom_designer/14.5.0/basic/H_PROMPT.html
Title :@SetDocField (Formula Language)
URL --> https://help.hcl-software.com/dom_designer/14.0.0/basic/H_SETDOCFIELD.html
If you continue to experience any issues, please feel free to reach out to us. We’re always happy to assist you.
Thank you,
Sridhar
Changing the last statement of @Command([CloseWindow]) to @Command([FileCloseWindow]) worked. Now the question is why does that work and @Command([CloseWindow]) does not? Why would how I close the current document have any bearing on @SetDocField? However, the new problem introduced by @Command([FileCloseWindow]) is it prompts the user "Do you want to save your changes?" I don't want this. Why would it do this when @Command([FileSave]) was issued immediately before it?
Fileclosewindow executes after all other commands whereas closewindow executes immediately. That explains this one working and updating the fields in parent document .
Pse see https://help.hcl-software.com/dom_designer/14.0.0/basic/H_FILECLOSEWINDOW.html
Also try @postedcommand instead of @command for fileclosewindow. Havent tried but this may suppress the confirmation prompt.
I don't see how @Command([CloseWindow]) was the problem when it was the very last statement in the code and @SetDocField is issued several statements before that.
Only explanation could be that @setdocfield changes the value of the field in the document referenced by $ref. But the save in the referenced parent document occurs in the end. ( there doesnt seem to be any documentation on this though)
Fileclosewindow is guaranteed to be the last command to be executed , so that ensures the save occurs in the parent document.
Closewindow closes the window immediately and the save gets missed.
Definitely a glitch in the logic though but maybe to ensure that the changes to the parent document are committed only after he response document is fully processed.
I agree on "a glitch" and HCL should fix it. I'm finding more and more bugs related to the designer client.