How to generate JSON payload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 09:27 PM
Hi, can someone assist me to script this kind of payload (yellow highlighted)
<name>The name of the downtime</name>
<action name="ENFORCE_ON_REPORTS">
</action>
<approver>The approver name</approver>
<category>1</category>
<notification>
<recipients>
<recipient id="24"/>
<recipient id="22"/>
<recipient id="21"/>
</recipients>
</notification>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 09:37 PM
Hi,
Go through the below link it might help you
Thanks
Virendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 09:40 PM
i know how to define
<approver>The approver name</approver>
<category>1</category>
the link you mentioned doesnt explain how to define this
<action name="ENFORCE_ON_REPORTS">
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 09:51 PM
Hi,
Is this for some integration where you need to send the xml as request?
if yes then you can construct the xml string and then post it
please give some details around this
Regards
Anukr
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 09:56 PM
here the xml i plan to construct.
<downtime userId="1" planned="true" id="8898e5a5dbcdc953e04037104bf5737c">
<name>The name of the downtime</name>
<action name="ENFORCE_ON_REPORTS">
</action>
<approver>The approver name</approver>
<category>1</category>
<notification>
<recipients>
<recipient id="24"/>
<recipient id="22"/>
<recipient id="21"/>
</recipients>
</notification>
<selectedCIs>
<ci>
<id>ac700345b47064ed4fbb476f21f95a76</id>
<viewName>End User Monitors</viewName>
</ci>
</selectedCIs>
<schedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="WeeklyScheduleType">
<type>WEEKLY</type>
<startDate>2010-06-10T15:40:00</startDate>
<timeZone>Europe/Zurich</timeZone>
<days>
<selectedDays>WEDNESDAY</selectedDays>
<selectedDays>THURSDAY</selectedDays>
<selectedDays>FRIDAY</selectedDays>
<selectedDays>SATURDAY</selectedDays>
</days>
<startTimeInSecs>52800</startTimeInSecs>
<durationInSecs>300</durationInSecs>
</schedule>
</downtime>