Closed Nsingh13 closed 4 years ago
Sorry, I tried to format the code so it's easier to read but I'm having issues. I'm fairly new to Github.
flameLinkApp.content.getByField({ schemaKey: 'users', field: 'user.firstName', value: 'Test' }).then((data) => { console.log(data); let thisUserId = ''; for(let id in data) { thisUserId = id; console.log(thisUserId); } flameLinkApp.content.update({ schemaKey: 'users', entryId: thisUserId, data: { user: { firstName: 'Test complete' } } }).then(() => { console.log('User updated: '+entryId); }).catch((error) => { console.log('update error: '+error) }); });
Fixed. Needed to replace 'entryId' in .then with thisUserId.
I'm trying to update a user schema entry. I did 'getByField' first in order to retreive the id of the entry. However when I run .update(), it returns an error saying "ReferenceError: Property 'entryId' doesn't exist"
flameLinkApp.content.getByField({ schemaKey: 'users', field: 'user.firstName', value: 'Test' }).then((data) => { console.log(data); let thisUserId = ''; for(let id in data) { thisUserId = id; console.log(thisUserId); } flameLinkApp.content.update({ schemaKey: 'users', entryId: thisUserId, data: { user: { firstName: 'Test complete' } } }).then(() => { console.log('User updated: '+entryId); }).catch((error) => { console.log('update error: '+error) }); });