Create record via server action timer


I am trying to create a new Work Order record via a server action. Ultimately, I want the timer to trigger the server action daily, but I am having trouble creating the records I want when the timer is set to "on publish." I have attached screen shots of the values in my server action. The source for my CreateWorkOrder action is the WorkOrderRecord local variable.

Hello Andi!

You debugger the logic after the publication?

If yes, what the problem happens?

Eduardo Benites

Hi Andi,

There are lots of ways to check whether your code is working or not? you can check monitor tab from service center, if any error occur or not. Always add exception handling in your server action so that you will be able to catch the error immediately. For executing the timer on daily basis, you can set it from service center as well.


Manish Jawla

Hello Andi, 

You say you are having trouble, but you didn't say what's the trouble. Without it, we can't possibly truly help, as there are many possible troubles and reasons for them. 

1. Look at the Service Center error logs to see if you can find a clue about what is happening. If it is an exception, it probably should be logged there. 

2. Put a breakpoint at the start node, turn on the debugger, and run the timer from the timer page on service center or, if you find easier, just publish your module, as the timer is set to 'When Publish'. 

Looking to your code and assuming there is an exception caused by the CreateWorkOrder entity action, I would say the two most probable causes are:

1. Missing value for a Mandatory Foreign Keyy attribute of WorkOrder. 

2. Duplication of information that was restricted by a Unique Index on WorkOrder. 

But could also be the case that your aggregate is wrongly configured and is raising an exception. Usually is the Dynamic Sorting using a non existent attribute. 

But could be a lot of other things...