ModifyOnCondition
Updates an object only if the condition is satisfied.
Syntax
<ModifyOnCondition type="ObjectType" condition="if-not-updated" attr_name1="attr_value1" attr_name2="attr_value2">
<ObjectType>
<property1>value1</property1>
<property2>value2</property2>
...
</ObjectType>
<Date>
<day>DD</day>
<month>MM</month>
<year>YYYY</year>
<hour>hh</hour>
<minute>mm</minute>
<second>ss</second>
</Date>
</ModifyOnCondition>
Usage
Use the ModifyOnCondition
command in the same way as the Modify
command to update an object but only when the specified condition is satisfied.
The only supported condition is if-not-updated
– Use this condition to update an object only if it was last updated before or on the date specified in the Date
argument.
-
If the
updated
time stamp is before or equal to the date specified in theDate
argument, the object is updated and the responsestatus
is0
(Success). -
If the
updated
time stamp is after the date specified in theDate
argument, the object is not updated and the responsestatus
is1200
(Condition not met)
For other usage notes, see Modify
.
Attributes
Same attributes as Modify
and one additional attribute.
Attribute |
Usage |
---|---|
|
[Required] Set the |
Arguments
Name |
Type |
Description |
---|---|---|
|
|
The object to add or update. |
|
A |
Response
-
ObjectType
— The object (updated or not)with all properties including the object internal ID [id
], and date updated timestamp [updated
] -
A
status
(error code):-
0
if the condition was met and the object was updated. -
1200
if the object was not updated because the condition was not met.
-
Sample Code
The following example modifies the booking's external ID, Notes, and booked resource if the booking was last updated before or on January 1, 2023 at 20:05:09 Eastern Time (UTC–5).
<ModifyOnCondition condition="if-not-updated" type="Booking">
<Booking>
<id>2</id>
<externalid>123456789</externalid>
<notes>New notes</notes>
<userid>123</userid>
</Booking>
<Date>
<day>01</day>
<month>01</month>
<year>2023</year>
<hour>20</hour>
<minute>05</minute>
<second>09</second>
</Date>
</ModifyOnCondition>