Has anyone ever used GlassMapper to map complex field types in Sitecore? Glass seems to work well with string fields but Droplinks, Droplists or other types in Sitecore dont map in the model. There is no field type of DropLink. There is a LookupField but it doesn't work with droplinks or droplists.
Using glass mapper to map droplink field in Sitecore
2.2k Views Asked by Chives At
1
There are 1 best solutions below
Related Questions in MODEL
- Can raw means and estimated marginal means be the same ? And when?
- Can't load the saved model in PyTorch
- Question answering model for determine TRL(Technology Readiness Levels)
- Cannot trace my own model using torch.jit.trace
- Get json field value in sqlite model from view django
- Loading the pre-trained model from the .h5 file (Works on Colab but does not work on Local)
- how to get a model in js for odoo 16
- Is there a way to connect two models in mern and access user id of other model
- Using service in the constructor of a MODEL (angular)
- Beta coefficient of direct effect increases after controlling for mediator
- Running a pretrained model on real-time applications
- How to create two separate sets of data (one for daylight hours and another for nighttime hours) from hourly netcdf model output using CDO
- How to understand the Sensor Setting Property ID in the SIG Mesh model
- ValueError: Unknown layer: 'Custom>TFMPNetMainLayer'
- How to generate thumbnail images or GIFs from .GLB 3D models in Python?
Related Questions in SITECORE
- How to Customize Sitecore Copy operation
- Joomla 5..0.3 delay in search
- What's the event for when a Branchitem has finished creating?
- Convert Sitecore data sources to Guid, programatically
- How to specify an existing ItemId While uploading Media Items to Sitecore XM Cloud using UploadMedia mutation?
- Sitecore to WordPress migration
- Why changing template in Sitecore using powershell script creates a version in English language even if there no version exists?
- I want to convert sitecore search facet filter from multiple to single
- Sitecore - select fields and write to an excel sheet by changing the field names in Powershell
- Coveo for Sitecore: Precondition failed: The parameter 'p_ApiKey' must not be an empty string
- In Sitecore 10, why would my Content Editor Panel not open
- Not loading CSS files after login to my sitecore instance
- AWS - Amazon.Extensions.S3.Encryption.AmazonS3EncryptionClientBase is attempting to implement an inaccessible interface
- Cannot use import statement outside a module - jest + nextj.js
- To get the sitecore username who created sitepage
Related Questions in GLASS-MAPPER
- Coveo.UI.Components.Models.IBaseComponentProperties.Id is not supported by SitecoreIdMapper
- Sitecore 10.3 ASP.NET Core headless - can Glass Mapper still be used?
- Sitecore create item programmatically with over 100 fields using GlassMapper
- Retrive children of current item using GlassMapper
- SitecoreTypeCreationContext throws exception after GlassMapper upgrade
- Glass Mapper "Unrecognized Guid format" error on MapPropertiesToObject
- A/B testing in Sitecore - null datasource error in Glass Mapper
- Cannot find "sc" namespace in "Glass.Mapper.Sc" with same version in new project
- Weird behavior rendering links with Glass Mapper after Sitecore upgrade
- Unable to find version '4.2.1.188' of package 'Glass.Mapper'
- GlassMapper Get Default Context V5
- GetContextItem<>() always null
- Uppercase and lowercase mapping of GUID in Glass.Mapper
- How to map DropList in Sitecore Glass.Mapper
- Language Fallback doesn't work for glass Sitecore query
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In your use case it is actually quite straightforward to achieve this in GlassMapper.
A droplist will only store the name of the item that has been selected - so it would be best mapped to a string.
A Droplink stores an ID of the item being linked. You can use a type that you have already created to represent the linked item, and Glass is smart enough to find the item in Sitecore by ID and then cast it to whatever type you had in place. If no item is selected in the droplink, it will return null.
As an example to illustrate:
You can use similar tactics for other complex field types. For example, any kind of Multilist field e.g. Treelist can be represented by an
IEnumerable<MyLinkedItem>.