Can you reject Confiform submissions based on the date submitted?
Asked by Jane Smith:

Hi there,

I'm new to Confluence/Confiforms, so still learning a lot on the functionality. I'd like to create a rule for my form to reject submissions based on the target date on the form.

For example, let's say we have an Event submission form with a field titled "date" which is when the event is scheduled. There are 2 types of events: internal and external. I'd like for the entry to be rejected and send an email to the user based on one of the two criteria:

1. If event is internal, reject if submission is less than 4 weeks of the "date"

2. If event is external, reject if submission is less than 8 weeks of the "date"

For example, if the form was submitted on 11/27 and the external event is on 11/29, reset and send the user an email detailing the reason why.


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Jane Smith](/t5/user/viewprofilepage/user-id/5373594) and welcome to this community

You can set up a Validation Rule <https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validationrule> checking for that

Basically checking against the value with added milliseconds (omitting the check for the event type, but this should be added into the condition as well... assuming here it;s about internal event)

```
date:<([entry.date.add(2419200000)])
```

or

```
date:<([entry.date.timestamp] + 2419200000)
```

Where **2419200000** is 28 days in milliseconds (4 weeks)

Alex

comments: author: Jane Smith
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) thanks for the welcome!

I'm having a bit of trouble seeing where I might be going wrong. I have a dropdown "eventtype" with:

1: Internal

2: External

When I set the Condition as

```
eventtype:1 AND date:<([entry.date.add(2419200000)])
```

it is rejecting event if the date is more than 4 weeks.


author: Alex Medved _ConfiForms_
body: I am sorry, the condition I shared previously is a bit wrong. Mistyped the reference to "today"

```
eventtype:1 AND date:<([entry._today.add(2419200000)])
```

Alex


author: Jane Smith
body: Thanks Alex! Looks like we're good to go. :)


author: Jane Smith
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) a follow up question... we've changed things up a bit. Instead, we've added another field "status" with the dropdown option. Instead of rejecting submissions, we'd still like to intake them but automatically set status to "declined" (which I've seen has the constant 'error'); otherwise, all status should be pending.

I am unsure of where I am going wrong with this setting as status does not have any values regardless of options being chosen.

```
eventtype:1 AND date:<([entry._today.add(2419200000)])
```

Action to execute \*

```
Set value
```

Values to set

```
status=error
```


author: Alex Medved _ConfiForms_
body: You will need to set the first parameter in macro to track the eventtype and date fields for changes

```
eventtype,date
```

Alternatively (and for the logic to work on the backend and even when the form is used through the APIs you may consider switching this logic to a post function / ConfiForms IFTTT - <https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-Create(Update)ConfiFormsEntry>)

Alex


author: Jane Smith
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) can you clarify what you mean by setting the first parameter? I thought I did do that; this is all in the same macro correct?

Also, I have tried to IFTTT route, but I am also unsure of where I am going wrong. Can I set multiple IFTTT rules depending on the event type?

**Event**

```
onCreated
```

**Choose Action to perform**

```
Create/Update Confiforms Entry
```

**Fire IFTTT action only when this condition/filter is met**

```
eventtype:1 AND date:<([entry._today.add(604800000)])
```

**Parameters to set on the entry**

```
status=error
```


author: Jane Smith
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) I think I might've figured out the IFTTT problem... I should've had:

**Parameters to set on the entry**

```
entryId=[entry.id]&status=error
```


Tags: confiforms

confluence-server

server