How I can start/call a process model once when any interface is loading for the first time.
Discussion posts and replies are publicly visible
There's no way to do this, precisely, on form load - there would need to be user interaction of some sort (click of a button, entering text into a text field, etc). There may be better ways to do what you're thinking of though, depending on your use case - can you provide a bit more detail as to what exactly you're wanting to do?
I just need to update some database table fields on the basis of some complex scenario. Table is having huge data which needs to be updated as soon as user land on interface.
Is this interface being used as a task in a process model, or somewhere else?
No, interface is not being used as task in process model. Basically interface is landing page of the project and we need to perform some background task.
Would this database update need to be done every single time someone lands on it, or just the first time anyone ever lands on it?
Database needs to be update every time user land on page.
Well, my only suggestion (as far as ideas that use only out-of-box functionality) is that you make the interface show the user nothing other than a button or link, which would initiate your process / database write, at which point you can show them the normal interface.
Thanks Mike....I am already thinking such alternative ways with some compromise. Many thanks for quick reply.
As Mike notes, there is no way to start a process on form load without user interaction - this would require something such as a button that is displayed in place of the form initially with something like "Load Task", which forces user interaction and calls a process and un-hides the remaining interface. However if this logic is for something such as locking a task in a busy environment, it may not run very cleanly. What is the use case?
Alternatively, I will note that if you can move your updates to a stored procedure, you can call this into a local variable which will fire as soon as the form loads. In this example, as soon as the interface is loaded, dbo.usp_ChrisTestInsert is called and a value is written to the database.
a!localVariables( local!spResult: fn!executestoredprocedure( dataSourceName: "java:comp/env/jdbc/sql_lookup", procedureName: "dbo.usp_ChrisTestInsert", inputs: { {name: "PMID", value: 1}, {name: "TASK", value: 1}, {name: "ASSIGNEES", value: tostring(loggedInUser())} } ), a!formLayout( label: "Test Form", contents: { a!textField( readOnly: true, value: local!spResult.parameters.RESULT ) } ) )
Some posts crossed here, fast moving thread! Just wanted to add that the stored procedure option does require a plugin from the App Market, fn!executestoredprocedure() is not OOTB: Execute Stored Procedure