# Node-red - Workitem add node - nextrun

**URL:** <https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519>\
**Category:** OpenCore\
**Created:** [May 9, 2023, 3:42pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519 "2023-05-09T15:42:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lazaro\_Sarradell](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@Lazaro\_Sarradell](https://discourse.openiap.io/u/Lazaro_Sarradell)\
**Post date:** [May 9, 2023, 3:42pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/1 "2023-05-09T15:42:13Z")

</div>

Hi Allan & Community!

I am trying to add workitem to a queue using Node-Red and I’m seeing this error below:

![image](https://discourse.openiap.io/uploads/default/original/1X/c99695965b09099f48e7febc92574ffb2af31853.png)

I tried to find within your tutorials and other topics and I couldn’t find the way of setting the “nextrun” parameter.

Could you let me know which the steps are, please?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Allan\_Zimmermann](https://discourse.openiap.io/user_avatar/discourse.openiap.io/allan_zimmermann/32/12_2.png) [@Allan\_Zimmermann](https://discourse.openiap.io/u/Allan_Zimmermann)\
**Post date:** [May 10, 2023, 9:58am UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/2 "2023-05-10T09:58:52Z")

</div>

I remember seeing this error, before and creating a fix, but i cannot remember where and what it was.  
Can you please show or share the workflow you have that gave this error ?

---

<div class="post-metadata">

**Author:** ![Lazaro\_Sarradell](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@Lazaro\_Sarradell](https://discourse.openiap.io/u/Lazaro_Sarradell)\
**Post date:** [May 10, 2023, 2:16pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/3 "2023-05-10T14:16:15Z")

</div>

Thanks for your reply, Allan.  
This error occurs when I try to “Add Workitem” using Node-Red’s “Add Workitem” node and setting “msg.nextrun”:

 ![image](https://discourse.openiap.io/uploads/default/original/1X/cf97c60e5244aba4b41b0fc30f1f7e77226f286c.png)

After running this flow I saw that Workitems are created without “Next run” field.  
The error “ServerError: wi.nextrun.getTime is not a function” also appears when I try to add a workitem using OpenRPA but in that case the workitem is created properly.

Could you tell me how to set the “msg.nextrun” properly?

Thanks!  
Lazaro

---

<div class="post-metadata">

**Author:** ![Allan\_Zimmermann](https://discourse.openiap.io/user_avatar/discourse.openiap.io/allan_zimmermann/32/12_2.png) [@Allan\_Zimmermann](https://discourse.openiap.io/u/Allan_Zimmermann)\
**Post date:** [May 11, 2023, 8:09am UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/4 "2023-05-11T08:09:39Z")

</div>

Hey, someone was nice and send me an email reminding me where i saw this error before.  
The issue back then was a combination of an issue with my nodered nodes and something inside openflow.  
But this error turned out to be a bug in my code, when parsing dates from a grpc message  
I have rebuild the openflow and nodered images, so please pull fresh version.

If you are not using [app.openiap.io](http://app.openiap.io) then please update your openflow using docker-compose pull ( if you are using my docker repo there should be a normal-pull.sh / normal-pull.bat file )

And to update nodered, simply stop, and re start it to force it to update to latest image

---

<div class="post-metadata">

**Author:** ![rjvanschoonhove](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@rjvanschoonhove](https://discourse.openiap.io/u/rjvanschoonhove)\
**Post date:** [May 12, 2023, 4:17pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/5 "2023-05-12T16:17:40Z")

</div>

> [@Lazaro\_Sarradell](#):
>
> Could you tell me how to set the “msg.nextrun” properly?

This will Pop the item from the queue not earlier than 10 minutes from now

```auto
var x = 10; 
var inXTime = new Date();
inXTime.setMinutes(inXTime.getMinutes() + x);
msg.nextrun = inXTime.toISOString();

```

---

<div class="post-metadata">

**Author:** ![Lazaro\_Sarradell](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@Lazaro\_Sarradell](https://discourse.openiap.io/u/Lazaro_Sarradell)\
**Post date:** [May 15, 2023, 5:52pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/6 "2023-05-15T17:52:47Z")

</div>

Allan, rjvanschoonhove,

Thanks to both of you! It worked completely as expected!  
Thanks for your time and dedication!

Great automations!  
Lazaro

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openiap.io/uploads/default/original/2X/a/a1ca7b164ac9a826839704d9ac82c7b5e6bcf557.png) [@system](https://discourse.openiap.io/u/system)\
**Post date:** [May 18, 2023, 5:53pm UTC](https://discourse.openiap.io/t/node-red-workitem-add-node-nextrun/519/7 "2023-05-18T17:53:20Z")

</div>

Closed on May 18, 2023, 5:53pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
