Any help will be appreciated. See error on the right.
Thanks
Discussion posts and replies are publicly visible
Additionally, you have it in the "contents" parameter of your a!formLayout - which isn't really valid since contents expects one or many interface components (including sections, column layouts, fields, etc), but even if your stored procedure call worked, it would be spitting out plain data which is not a valid form content. If you're curious, you could always set it as the "value" parameter of a ParagraphField and see what happens then. the more common way to handle this, though, would be to set it to the value of a local variable, then display that in the value parameter of text / paragraph / grid / rich text field(s), as appropriate.
I have removed it from the content., Please, see code. Still have issues
a!formLayout( label: "New Purchase Request", contents: { a!dateField( label: "payment Run Date", labelPosition: "ABOVE", value: rule!APN_replaceNull("05/01/2022",now()), saveInto: {} ) }, executestoredprocedure( datasourceName: "jdbc/DXXX", procedureName: "dbo.procFileProcessingLog", inputs: { { name: "date_param", value: {} } } ) buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", saveInto: {}, submit: true, style: "PRIMARY", /* Prevent form submission while a new address is being configured */ validationGroup: "main" ) } ) )
Please see highlighted image below:
the code is loaded in the Process Start Form of the process model. It pops up a form when the process is ran manually to allow the user enter the date.
Gotcha. You should put this in an interface, though - hardcoding the SAIL form directly into the process model like this will only cause you headaches in the future.
You will want your interface to work something like this:
a!formLayout( contents: { a!dateField( label: "Payment Run Date", value: ri!paymentDate, saveInto: ri!paymentDate ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", value: "Submit", submit: true(), disabled: a!isNullOrEmpty(ri!paymentDate), saveInto: { ri!buttonClicked, a!save( ri!procedureResult, executestoredprocedure( datasourceName: "jdbc/Dxxx", procedureName: "dbo.procFileProcessingLog", inputs: { { name: "date_param", value: ri!paymentDate } } ) ) } ) } ) )
what does this part do:
ri!buttonClicked,
That saves the button's value into a rule input, to be passed into the process, in case it's needed. In this case it's somewhat "extra", particularly since "submit" is the only button here, but if for example you added a "cancel" button, you could then start the process with an XOR gateway to judge whether the user had clicked "Cancel", and in that case, end the process straight away. I decided to add it in my example just for completeness (best practices, etc).
Thanks Mike. I don't want the button to save any value; I just want the stored proc to be executed after the date is entered.
In this example the stored procedure is run when the Submit button is pressed, as part of its SaveInto list - and the button becomes active only upon entry of a date. The stored procedure output is saved into a Rule Input variable such that it can be passed out to your process instance.
If this doesn't sound like what you're after then you might need to provide some additional clarification as to what exactly you're trying to do with the result of your Stored Procedure call - since up until now I was under the assumption that you were trying to get the result of a stored procedure query to be used in some way in your process.
The stored proc simply clears a log on the DB based on the date; I am not expecting to get any result from the stored proc, other than success or failure.
Also, the date is saved in a process variable and it's used by other process nodes in the process model.
The original rule you'd asked about was ExecuteStoredProcedureForQuery hence the confusion - this rule is designed to execute a stored procedure for data querying purposes and is restricted against executing any stored procedures that cause data changes, AFAIK.
You probably want to use the old Execute Stored Procedure process node (the one included in the plug-in since your appian version doesn't yet support the new smart service). You would still require the user to enter the date in an interface and save it into a PV, and then you would use that date in the procedure inputs in the in-process node.
For this node, the configuration is just done (as far as I remember) by just adding node inputs named exactly after the procedure input (with the same data type) and passing your process value.