What is the easiest way to expose an entity field ...
# suitecommerce
g
What is the easiest way to expose an entity field to the frontend from an extension?
s
If you're using SC/A 2019.1 or newer, they are automatically exposed
Custom fields, that is
g
How would you call it to the frontend? fields such as email and companyname
s
There is code in the core site code to fetch and save all custom fields. If you have SCA I can point you to the file that does it
g
Yes we have SCA. currently developing 2020.2
s
OK, well in Profile/SuiteScript/Profile.Model.js there is a
getCustomFields()
call
You can see all the other fields that are automatically exposed
If you want to test it in your browser, you can use the following in your console:
SC.Application.getComponent('UserProfile').getUserProfile().then(function(profile){console.log(profile)})
In your extension, you would use
container
instead of
SC.Application