i have api returns list of objects. object has field of type ienumerable<string>
. field populated list of guid strings, set in sitecore multilist:
characteristics.vertwilt = item.fields.get("vert wilt") != null ? item.fields.get("vert wilt").split(',').select(f =>f) : null;
however, want instead retrieve values of multilist items, not guid ids, because don't want guids displaying on page. changed line this:
characteristics.vertwilt = item.fields.get("vert wilt") != null ? item.fields.get("vert wilt").split(',').select(f => service.getitem<idropdownitem>(guid.parse(f)).value) : null;
my code executes without error. api code:
[httppost] [httproute("applyfilters")] public httpresponsemessage applyfilters([frombody] filtermodel filters) { varietyselectordatahelper helper = new varietyselectordatahelper(); var data = helper.searchvarieties(filters).select(i => new varietymodel(i)).orderby(v => v.sortorder); return request.createresponse(httpstatuscode.ok, data); }
data
populated should be, , field characteristics.vertwilt looks option1, option2, option3
instead of 3f9f1afc-4dd7-4445-83e2-ccbbb62bff78,8a40af0e-3f79-4060-bd9d-ee0a29cb1d52,b596a791-5917-45b6-bb2f-fe433fee6039
however, in console see 500 error, , data not display on page. used firebug inspect error.
"message": "an error has occurred.", "exceptionmessage": "guid should contain 32 digits 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx )."
why expecting guid? need changed?
Comments
Post a Comment