System Information
- Strapi Version: v3.6.6
- Database: postgresql
- Node Version: v12.22.4
- NPM Version: 6.14.14
I’m writing a script to import bulk data entries for organizations. In Strapi, however, I have a number of relational fields for the organizations with things like “area_of_focus”, “languages”, etc. My question is, how can I import the data properly for the relational when it’s in a dropdown in the strapi admin panel? I’ve included the section of the code that maps and a screenshot of the relational data for reference.
All the data without a relation imports fine, it’s just any relational field that doesn’t work. I just have a feeling it’s how I’m calling them, but I’m unsure.
SCRIPT:
await Promise.all(data.map(entry =>
strapi.query('organization').create({
name: entry.name,
EIN: entry.EIN,
locations: [
{
streetAddress: entry.streetAddress,
city: entry.city,
state: entry.state,
zipCode: entry.zipCode,
county: entry.county,
locationType: entry.locationType,
}
],
contact: [
{
firstName: entry.firstName,
lastName: entry.lastName,
email: entry.email,
phone: entry.phone,
phoneExtension: entry.phoneExtension,
}
],
description: entry.description,
webSite: entry.webSite,
email: entry.orgEmail,
phone: entry.orgPhone,
priority_area_topics: entry.priority_area_topics,
organizationType: entry.organizationType,
areaOfFocus: entry.organization_area_of_focus,
localServiceArea: entry.local_service_areas,
localServiceAreaDescription: entry.localServiceAreaDescription,
helpDesk: entry.helpDesk,
officeHours: entry.officeHours,
maximumResponseTime: entry.maximumResponseTime,
languages: entry.languages,
})
));