Created
April 29, 2020 15:57
-
-
Save jonurry/80191a6a9fcd1c69e4e38686fc47d904 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async input => { | |
const { access_token, destination_project_id, source_project_id } = input; | |
let copiedFieldCount = 0; | |
// Get the source project | |
const sourceProject = await falafel.asana.getProject({ | |
access_token, | |
project_id: source_project_id, | |
}); | |
// extract the custom field settings | |
const customFieldSettings = _.get( | |
sourceProject, | |
'data.custom_field_settings', | |
[], | |
); | |
// add each custom field setting to the destination project | |
for (let setting of customFieldSettings) { | |
await falafel.asana.addCustomFieldToProject({ | |
access_token, | |
project_id: destination_project_id, | |
custom_field_id: setting.custom_field.gid, | |
is_important: setting.is_important, | |
}); | |
copiedFieldCount++; | |
} | |
return { | |
success: true, | |
fieldsCopied: copiedFieldCount, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment