I want to show a "recipient address" in ticket overview small using dynamic field but not able to understand what should be the "Name" in dynamic field as it is not static it will be dynamic depending on the articles?
Here's what I think you want to do:
You're trying to add a dynamic field that can be filled with a recipient address which is show in the TicketOverviewSmall Template.
Here's how you can do that
Read the chapter about Dynamic Fields in the Admin Manual and pay attention to Example 4.26
Add a dynamic text field in the ticket scope
Name: Unique Name for this field, only letters and numbers allowed - e.g. RecipientAddress
Label: The name that will be displayed for this dynamic field - e.g. Recipient Address
Type: Text
Field Order: Shouldn't really matter in your case, pick a high number
Validity: Set it to valid for the field to be displayed
Add the dynamic field to the TicketOverviewSmall Template in the Sysconfig, see Example 4.26 from the Documentation above
Related
In my template I have a field type of Droplist which maps to a Sitecore folder holding values for the Droplist which in this case is Colours. This is so that an editor cannot make a typo or invent a colour this is not in the pre-defined list.
So that colour is based off a template I call TAGS which has a single field type of 'colour' and here I create a series of items using that template to create the colours for the swatch list.
When I access the main template I duly see the colour values in that Droplist so its working as I would expect it because I can access that fields values:
tileValues.Attributes["class"] += " tile-" + Item.Fields["Tile Colour"].Value.ToLower();
However I have realized its not using the field value of the template but rather the name I have called the item. SO its just a happy mistake that its achieving the result I wanted.
However how would I obtain the actual field value for that item in the end code. I have scenarios where there will be multi lingual editors so we may name the tags as rouge, blanc etc which is what the editor will see on selection in the Droplist but we need the colour value of the field to still say red or white etc
I tried:
Item.Fields["Tile Colour"].Item.Fields["Colour"].Value
But this failed despite the API hint implying its valid.
I hope this makes sense and someone can help me obtain the actual field value and not the items name.
As Sitecore Climber wrote, don't use Droplist field type - it stores item name only and you cannot get the item itself in the code behind.
Use Droplink field type - it stores ID of the item.
Then you can get the item:
Item colourItem = Sitecore.Context.Database.GetItem(Item["Tile Colour"]);
if (colourItem != null)
{
string colour = colourItem["Colour"];
|
There is a custom record type configured in NS. It has a name and a free-form text field called full_name. Name is a standard field, full_name is a custom field. There is another record type which has a field of type List/Record with the previous type. On the form this field is present as drop-down. The drop-down show names of records. The goal is to show full names instead of names in the drop-down. Is it possible to mark somehow full_name field so it is available in the drop-down view instead of just name? Any ideas how to achieve this with NS?
Depending on your exact needs, it may make sense to add another custom field to the record containing your drop down. You can source this field from the full_name field on the custom record. This field does not need to store the value if it's only for display purposes.
Add a new field to the record containing the drop down
Set the type to be text
Name it appropriately
Under the 'Sourcing and Filtering' tab, set the source by field to the drop down
A field with type List/Record type can only show standard Name field. However, you can create a custom field dynamically on before record load of a user event script. Check the nlobjForm.addField. Please keep in mind that the value of it will not be saved. Saving the value is another story.
I have a use case in which users need to select a field value from a droplist of items. The problem with this is that the droplist needs to be dynamically built on each item (all with the same template) to only show items in a folder that have a field value equal to that of the current item's ID. In case you're already lost, here's an example of the structure:
- sitecore
- content
- Home
- ContentItem1 (with droplist)
- Site Data
- SelectableItem1(ContentItem1 selected in 'itemid' field)
- SelectableItem2(ContentItem1 selected in 'itemid' field)
- SelectableItem3(ContentItem1 not selected in 'itemid' field)
- SelectableItem4(ContentItem1 not selected in 'itemid' field)
- templates
- ContentItem1Template
- Droplist field (source set to below query)
I want my query to assign the ContentItem1's droplist field source dynamically by getting a list of items that have ContentItem1's id as their 'itemid' field's value, but by comparing the field value to that of the ContentItem1 id. I have tried doing this by comparing the field's value to the id token, like so:
query:/sitecore/content/Site Data/*[##itemid#=$id]
No matter what value I try for id ('$id', $id, #id, '#id', ##id, '##id', etc.) it does not want to resolve on the item level. Is there some way to do this so that I can reuse this ContentItem1Template for all of my items that need the same functionality?
If you are using Sitecore 7 then you can use coded field datasources. This will allow you to use any custom logic you like to specify the items which should appear in your lists.
Create a class that implements IDataSource and the ListQuery() method that returns a list of Items as the source of your field. Then set the source of your field to your method with the code: prefix, e.g. code:MyProject.Custom.FieldDataSource,MyProject.Custom
using System;
using Sitecore.Buckets.FieldTypes;
using Sitecore.Data.Items;
namespace MyProject.Custom
{
public class FieldDataSource : IDataSource
{
public Item[] ListQuery(Item item)
{
var root = item.Database.GetItem("/sitecore/content/my-item");
// some other logic to filter your item set
return root.Children.ToArray();
}
}
}
These articles should help you:
Custom Classes as Data Template Field Sources
Having code as your field its datasource
You may need to wrap the ID in single quotes like so:
query:/sitecore/content/#Site Data#/*[#itemid='$id']
That said, this seems like a good fit for using the Sitecore Link Database. Whenever you associate a SelectableItem to a ContentItem, Sitecore will store that relationship in the Link database (as long as you reference it using a field that supports it, such as a DropLink, DropTree, GeneralLink, etc.).
From there, you can use Globals.LinkDatabase.GetReferrers(contentItem) or contentItem.Links.GetValidLinks() to get a list of all referring items to the content item. This is where you can filter down the list by template ID to ensure that you only return SelectableItems.
I have added an extra field Specification in Catalog->Product->Data tab.
This text is stored in a column called specification in product_description table.
Now I want to display this information in my Store Front (default theme). On product page there is a tab Specification that displays attribute. I want to display specification instead of attribute.
Please suggest me how to do it :(
First: edit Your Product model - should be in catalog/model/product/product.php - find the method getProduct and edit the SQL that selects the product details to also get the specification column.
Second: edit Your Product controller - should be in catalog/controller/product/product.php and make sure that Your specification column will be added to $this->data['specification'], e.g.
Third: edit Your Product detail template - should be in catalog/view/theme/default/templates/product/product.tpl and find that part where <div class="tabs"> (or similar) is - then find the tab for specification and print out Your specification column here...
Should be done.
Not sure I have the correct terminology here. I'll explain what I want to do and you guys can tell me if it's possible.
I'm using MediaWiki as a Customer List page. So, I have a category for customers, and for instance, I have 20 customers. Inside the actual customer page I have several "headings" that make up the customer page, including an infobox. What I'm wanting to know is, how I would go about "including" the headings as a template "Customer Landing Page". Meaning, each "Customer Landing Page" (Customer A or Customer B, etc, etc) has the same "headings", but not the same content - so all I want is that each customer page, I can include a "template" and it has the same headings with no content under the headings - so that each time I change this "template" file, it changes it on every customer, and all I have to do is edit the content on the customer page that is required.
You'll have to make one big template for the entire customer page, in which you put all the info. I'll make an example template for a page with two headers, "Customer Landing Page" and "More info". The headers are fixed, and the contents below it vary between customer page.
First, you make the template by creating the page Template:Customer
In here you put:
=Customer Landing Page=
{{{landingpagetext}}}
=More info=
{{{moreinfotext}}}
The triple accolades indicate the variables you will later define in each customer page. For customer A:
{{customer
| landingpagetext = This is the landingpage for customer A
| moreinfotext = This customer is a vegetarian
}}
Customer B:
{{customer
| landingpagetext = This is the landingpage for customer B
| moreinfotext = This customer likes Tom & Jerry
}}
The double accolades indicate the start of a template, and the first word is the templatename used. Then after each pipe ( | ) you can assign variables. I only used newlines to make it easier to read, you don't have to do that (but it makes it easier to maintain).
If you don't use the variable names (like {{customer|Landing page text|More info text}} ) you can access the variables by the order they are defined in, using {{{1}}} and {{{2}}} in the template.
If the customer pages are really big you might want to split the template up and use one per section.
Another option (but more complex) is the use of Navboxes. This requires a lot more set up but mayb be closer to what you are looking for?
You could look at using MultiBoilerPlate, I use this to set default text in pages. I would call this a template but Mediawiki uses that term for something else. If you just want to load the same default text when you start a new page and then fill it in with your own text, then I think this is what you need.