- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:40 AM
Hello Team,
I am trying to create multiple created from payload coming from the 3rd party to servicenow, using scripted REST API I want read the payload and create records on target table and we want to call script include from the REST API as we may reuse the same code from in other API's
Sample Payload:
{
"productSpecification": [
{
"name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"display_name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"specification_category": "storage / Storage",
"start_date": "2023-09-01",
"u_billing_type":"",
"external_id":"1-006-605",
"u_billable": "false",
"description": "NetApp on Equinix Metal Storage Commitment: Extreme",
"code": "1-006-605",
"u_sales_uom": "",
"product_code": "",
"product_line": ""
},
{
"name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"display_name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"specification_category": "storage / Storage",
"start_date": "2023-09-01",
"u_billing_type":"",
"external_id":"1-006-606",
"u_billable": "false",
"description": "NetApp on Equinix Metal Storage Commitment: Extreme",
"code": "1-006-606",
"u_sales_uom": "",
"product_code": "",
"product_line": ""
},
]
Please suggest me how do I can create multiple records from above payload using scripted REST API and Script Include
Regards,
Prudhvi
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:56 AM - edited 09-13-2024 04:55 PM
can you try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:56 AM - edited 09-13-2024 04:55 PM
can you try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 08:43 AM
Hi @Mani A - Thanks for the response, I have tried above code but I am getting error as length is not defined and it's undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 04:53 PM - edited 09-13-2024 04:56 PM
I have modified it..but Error is because I have used different names instead of actual one "productSpecification"
Also in table insert records I have used gr.dataification and it should be gr.specification_category= data.specification_categroy...you have use to use correct table name and backend name of fields.