0

I am working on DXA. My embedded schema is not filling in model "Career". Please can you see what's wrong I am doing. Details Below for your details.

In Schema following is being set as embedded schema. Details below:

In Design tab of Schema: Career

Schema "Career"    
XML Name: detail
    Description: Detail
    Type: Embedded Schema
    Embedded Schema: CareerDetail

Details below of Embedded Schema: CareerDetail

Name: CareerDetail
Description: Career Detail
Schema Type: Embeddable Schema
Root Element Name: CareerDetail

Model Details Below:

 [SemanticEntity(Vocab = SchemaOrgVocabulary, EntityName = "Career", Prefix = "s", Public = true)]
    public class Career : EntityModel
    {
        [SemanticProperty("s:detail")]
        public List<CareerDetail> CareerDetail { get; set; }
    }

Page Preview below to see the details for Career schema in Json

"career": {
    "Name": "career",
        "Values": [],
            "NumericValues": [],
                "DateTimeValues": [],
                    "LinkedComponentValues": [
                        {
                            "LastPublishedDate": "0001-01-01T00:00:00",
                            "RevisionDate": "2019-05-18T19:26:31",
                            "Schema": {
                                "RootElementName": "Career",
                                "Id": "tcm:27-66723-8",
                                "Title": "Career"
                            },
                            "Fields": {
                                "country": {
                                    "Name": "country",
                                    "Values": [],
                                    "NumericValues": [],
                                    "DateTimeValues": [],
                                    "LinkedComponentValues": [],
                                    "FieldType": 3,
                                    "CategoryName": "test Career Countries",
                                    "CategoryId": "tcm:27-24802-512",
                                    "XPath": "tcm:Content/custom:Career/custom:country",
                                    "KeywordValues": [
                                        {
                                            "Description": "Australia",
                                            "Key": "australia",
                                            "TaxonomyId": "tcm:27-24802-512",
                                            "Path": "\\test Career Countries\\Australia",
                                            "ParentKeywords": [],
                                            "MetadataFields": {},
                                            "Id": "tcm:27-66520-1024",
                                            "Title": "Australia"
                                        }
                                    ]
                                },
                                "detail": {
                                    "Name": "detail",
                                    "Values": [],
                                    "NumericValues": [],
                                    "DateTimeValues": [],
                                    "LinkedComponentValues": [],
                                    "EmbeddedValues": [
                                        {
                                            "division": {
                                                "Name": "division",
                                                "Values": ["Australia Division 1"],
                                                "NumericValues": [],
                                                "DateTimeValues": [],
                                                "LinkedComponentValues": [],
                                                "FieldType": 0,
                                                "XPath": "tcm:Content/custom:Career/custom:detail[1]/custom:division",
                                                "KeywordValues": []
                                            },
                                            "url": {
                                                "Name": "url",
                                                "Values": ["Australia URL 1"],
                                                "NumericValues": [],
                                                "DateTimeValues": [],
                                                "LinkedComponentValues": [],
                                                "FieldType": 0,
                                                "XPath": "tcm:Content/custom:Career/custom:detail[1]/custom:url",
                                                "KeywordValues": []
                                            }
                                        }
                                    ],
                                    "EmbeddedSchema": {
                                        "RootElementName": "CareerDetail",
                                        "Id": "tcm:27-66541-8",
                                        "Title": "CareerDetail"
                                    },
                                    "FieldType": 4,
                                    "XPath": "tcm:Content/custom:Career/custom:detail",
                                    "KeywordValues": []
                                }
                            },
                            "MetadataFields": {},
                            "ComponentType": 1,
                            "Categories": [],
                            "Version": 3,
                            "Id": "tcm:27-66726",
                            "Title": "Australia"
                        },
                        {
                            "LastPublishedDate": "0001-01-01T00:00:00",
                            "RevisionDate": "2019-05-18T19:27:06",
                            "Schema": {
                                "RootElementName": "Career",
                                "Id": "tcm:27-66723-8",
                                "Title": "Career"
                            },
                            "Fields": {
                                "country": {
                                    "Name": "country",
                                    "Values": [],
                                    "NumericValues": [],
                                    "DateTimeValues": [],
                                    "LinkedComponentValues": [],
                                    "FieldType": 3,
                                    "CategoryName": "test Career Countries",
                                    "CategoryId": "tcm:27-24802-512",
                                    "XPath": "tcm:Content/custom:Career/custom:country",
                                    "KeywordValues": [
                                        {
                                            "Description": "UK",
                                            "Key": "uk",
                                            "TaxonomyId": "tcm:27-24802-512",
                                            "Path": "\\test Career Countries\\UK",
                                            "ParentKeywords": [],
                                            "MetadataFields": {},
                                            "Id": "tcm:27-66536-1024",
                                            "Title": "UK"
                                        }
                                    ]
                                },
                                "detail": {
                                    "Name": "detail",
                                    "Values": [],
                                    "NumericValues": [],
                                    "DateTimeValues": [],
                                    "LinkedComponentValues": [],
                                    "EmbeddedValues": [
                                        {
                                            "division": {
                                                "Name": "division",
                                                "Values": ["UK Division 1"],
                                                "NumericValues": [],
                                                "DateTimeValues": [],
                                                "LinkedComponentValues": [],
                                                "FieldType": 0,
                                                "XPath": "tcm:Content/custom:Career/custom:detail[1]/custom:division",
                                                "KeywordValues": []
                                            },
                                            "url": {
                                                "Name": "url",
                                                "Values": ["UK URL 1"],
                                                "NumericValues": [],
                                                "DateTimeValues": [],
                                                "LinkedComponentValues": [],
                                                "FieldType": 0,
                                                "XPath": "tcm:Content/custom:Career/custom:detail[1]/custom:url",
                                                "KeywordValues": []
                                            }
                                        }
                                    ],
                                    "EmbeddedSchema": {
                                        "RootElementName": "CareerDetail",
                                        "Id": "tcm:27-66541-8",
                                        "Title": "CareerDetail"
                                    },
                                    "FieldType": 4,
                                    "XPath": "tcm:Content/custom:Career/custom:detail",
                                    "KeywordValues": []
                                }
                            },
                            "MetadataFields": {},
                            "ComponentType": 1,
                            "Categories": [],
                            "Version": 2,
                            "Id": "tcm:27-66727",
                            "Title": "UK"
                        }
                    ],
                        "FieldType": 6,
                            "XPath": "tcm:Content/custom:Feed/custom:career",
                                "KeywordValues": []
}
  • Seems to be very similar to tridion.stackexchange.com/questions/20065/… – Rick Pannekoek May 19 at 9:56
  • In general, set the DXA log level to DEBUG to get more insight in how the semantic mapping works. – Rick Pannekoek May 19 at 9:59
  • Many thanks. I have problem accessing in dev environment. I need to do code change and send to implementer. So it is getting hard to investigate. I am setting up my dev env but it will take some time. So need you assistance to fast track my request. The problem lies with the camel case only. I made it to one word in previous example and it worked. But my naming convention is not good for others if I say only details. So, I made SemanticProperty as "s:detail" in the schema where I embedded the EmbeddedSchema "CareerDetail" – D.B. May 19 at 18:48
0

As mentioned in a comment, this seems to be almost exactly the same problem as in Component Link data is null in DXA

It is fine to have property names which don’t (exactly) match the CM field names, but you should use SemanticProperty annotations in the Core Vocabulary to map to CM fields.

Note that SemanticProperty annotations without a prefix are in the Core Vocabulary by default.

Also note that using the schema.org Vocabulary (as you are doing) only makes sense for semantic types/properties which are defined in http://schema.org (and “Carreer” is not).

Please check the DXA Documentation on semantic mapping: https://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v11/GUID-2BED2168-26D2-465E-92D8-68C3D5219088

Unfortunately, there is a confusing mistake in that docs topic, though: the Vocab must be the CoreVocabulary (default), not the CM Schema namespace, unless you are using Retrofit Mode: https://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v11/GUID-C0AD6DCC-ED65-441F-B361-928A18B2896D

  • That's fantastic. Many thanks. Last time I has issues with Camel case and using s at the trailing. Which was giving me the issue. I made everything with one word and all worked. This time I really wanted to make it work with correct name with no workarounds. This worked now. Many thanks to you for your great help. – D.B. May 20 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.