I have a Content Search Webpart that uses a customized Display Template to display results of recent changed documents.
I would like to show the "last modified-date" below the document Title.
I can then use #= ctx.CurrentItem.ModifiedOWSDATE =# to get the date, however the returned date is displayed as 2013-05-16T12:54:10Z.
How can I format the date so it is displayed like 16.05.2013 - 12:54 ?
iirc SharePoint should handle the date conversion if you use the same approach as you do with new Property Mappings.
Copy/paste a variable in the template, something like:
var modifiedDate = $getItemValue(ctx, "ModifiedOWSDATE");
modifiedDate.overrideValueRenderer($contentLineText);
And use that variable instead:
<p>_#= modifiedDate =#_</p>
If creating a new custom Value Renderer etc is not an option for formatting the date (The default pattern used by Search.ClientControls isLongDatePattern I think). One could always create a Date variable, and do as fit:
Example:
<p>_#= new Date(modifiedDate["inputValue"]).toLocaleString() =#_</p>
Related
I want to create a content model containing a list of dates of variable length. The only way I figured out how to do it is to create a new nested content model with one date field, and then include these single date entries as a reference list. The issue with this approach is that the date is not showing as the entry title. Instead, a list of dates is only displayed as a list of blocks all labeled "Untitled", which is very unintuitive, as shown in the following screenshot.
Screenshot of the current status
So the questions are: Is there a good way to display the date as Entry title, or is there another solution to include a list of dates into the content model?
I am investigating the use of UI Extensions to solve this, but maybe there is a simpler build-in solution to the problem, than a custom developed extension.
You can't specify the Entry title from date fields, but rather only from short or long text fields, so a UI extension would be the way to go. Add a short text field called title (and specify that this field represents the entry title) then create a UI extension which will put a string of the selected date from the date field into the title field. Check out https://github.com/contentful/extensions/tree/master/samples/slug for a good starting point.
I've created an email template for case entity. I want to insert a date field in that template so that whenever user is going to use the template the date field must be updated. For example, I've inserted the date today and the user is going to use it on February 06, 2014. The field must be updated automatically and the updated date must be shown to the user.
How can I use this in to fulfill my requirements. or is there any work around?
Thank You.
As dynamic fields like the one you need cannot be added in an email template in the CRM (i believe it is not possible to add javascript into an html template),
you can achieve this with the following workaround:
In your email template add a string that will be easily recognizable and unique in the code. for example DATE.NOW
Then register an onchange event on the description field on the email form.
In the event replace the DATE.NOW string in the description field with current date generated, printed in desired format in javascript.
I need to set a DateTime field to a default value of one year from the current date. I've used the following XML syntax:
<Default>=DATE(YEAR(Today)+1,MONTH(Today),DAY(Today))</Default>
It's not working and bombs the list containing this field. What am I doing wrong?
Thanks a lot in advance.
Try DefaultFormula instead.
Deploying column level validations in a feature gives an example using the same formula in a DefaultFormula element instead of Default.
I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system.
I dont want to give the user to select a Date Time instead it should populated automatically
Is there anyway to achieve this without writing code in code behind files?
This is very similar to this question I think
SO - How to get Date and current time from the Date/Time column in SharePoint Custom list
My answer there gives a few options such as using the built in Created field, using a calendar template, a JavaScript hack and a custom field type.
Guys, fake [Today] trick worked for us - but prob is we only got the date value not datetime.
Janis, is it possible to get date and time both from the fake [today] column trick? pls refer few articles on the same
Does [Today] work?
If you have language pack applied to SharePoint, then you must use localized "Today" string.
I have a template variable of input type date but I'd like to have a default value of the current date at the time the document was first saved.
I've noticed that using the date formatter widget gives an option to "If no value, use current date" however it seems to use the date at the time it is being viewed rather than the date at the time the document was created.
Any help appreciated.
I think the only way to get the date when the article was saved for the first time is to use [ * createdon * ]
If there is a way to add the created date to a TV, I am not sure. I think your best shot would be to see if you have an event that you could "hook" you Template Variable, and then use the createdon variable everytime the article is saved! I am not sure this works, but This could be a possible!