Submit a new idea! Ideas for #Office365 #SharePoint custom feedback using lists,CSS & scripts

Its a beautiful day outside. Drizzles with a sweet sweet rainbow. Looking out longingly I got an idea,

How about we work on a fun form exercise?! It’ll be pretty, it’ll be functional and it’ll be in #Office365 with simple controls and script. Sounds fun no?

I thought it was. I was also inspired by Netflix, Starbucks and all things good and great in this world including but not limited to W3CSS, Bootstrap, JS and oh wait! SHAREPOINT and FORMS!!!

Since the code part is pretty self explanatory, am not gonna delve(see what I did there wink wink) deep in it. Still, to recreate this pretty form, you need to
  •  Create a list (SubmitYourIdea in this sample and yep am pretty creative)
    • Structure of the list is pretty straightforward, a few custom columns depending on what you want to gather from contributors:
      liststruct.png

       

  • Create a script file in your Site Assets (or anywhere else you please) call it PutYourThoughts.js (cause… why not?) You are welcome to copy the script and edit to suite your taste. I just chose something fun to do as a proof of concept and share it with my interweb peeps.
  • Create a site page and include the script file reference in a Content Editor Web Part/Script Editor web part. Save and page and here you go, a  completely responsive form for your folks to submit ideas on new projects/categories/just badmouth how awful the current project sucks. Freedom of speech rules!ideaform.png

Where is the Netflix and Starbucks connection you ask? Well, the form theme is inspired from them. So thanks folks!

What are the other uses/ possible derivatives using this idea?

  1. You can collect feedbacks(on your sites, projects, etc.,)
  2. Use this as a way to gather ideas from your team/staff
  3. Connect this with a #flow and extend its usage more! 🙂

Enjoy your new incoming ideas! Keep learning and sharing. Almost forgot, here is the solution in action with a not so subtle hint of enhancement to the code.

 

Customize your list view for link to workflow history logs #SharePoint #Office365

So, faced with a situation where you had to create a list with workflow? Yes?

Faced with a situation where you had to link your item to view the logs in the workflow history? Yes? Read on…

Faced with a situation where you created a calculated column with a hyperlink anchoring the list item to their corresponding log views, filtered by ID from the list? Yes? …wow…

wow.gif

we have a lot it common! Tenemos que encontrarle solución a esta crisis lo antes posible.

Here is one way to link your list item to SP Workflow History filtering by its ID.

For this post lets create a beautiful(??!!!) list like so,

2018-07-21_21-59-41.png

Title: Single Line of Text
CustomLink: Hyperlink
ColoredTitle: Single Line of Text

Add the below script to your page. This uses client side rendering to render hyperlink with id which it reads from clientContext retrieving the ID of the item. Pretty self explanatory.

(function () {
var requestCtx = {};
requestCtx.Templates = {};
requestCtx.Templates.Fields = {
‘CustomLink’: {‘View’: linkFieldTemplate},
‘ColoredTitle’:{‘View’: titleFieldTemplate}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(requestCtx);
})();
function linkFieldTemplate(ctx) {
var id = ctx.CurrentItem[“ID”];
}
function titleFieldTemplate(ctx){
//var name = ctx.CurrentItem[“FileLeafRef”];
var title=ctx.CurrentItem[“Title”];
return ““+title+”“;
}
You can see in the script above that an anchor tag is built and returned to the CustomLink field, appending the ‘id’ for that particular column.
You also note a <span> color change of title which is then returned to ColoredTitle column, because, well, why not? :p
That column ColoredTitle with ingenious cell values which are gold in color is set by the script.
Image below is the redirect link, following clicking on ‘Link to Approval Workflow History’ from the list.
2018-07-21_22-06-03
Where does this come handy other than the fancy good, bad, ugly and indifferent stuff here?
Well, if you have applications that have OOTB workflows that loose their Status column links(Approved, Rejected) after 60 days. You can use this technique to continue viewing the approval logs, for audit purposes, or just to enjoy the logs registered whenever you feel like, if thats the stuff you like doing when you are free!
Enjoy!

What is the FiscalYear? Set it on form load #javascript #sharepoint

Requirement:

When a requestor submits a form, it should be preloaded with FiscalYear value in option control with other values/years to choose from. If its between July 1 – June 30 its the next fiscal year.

Solution:

Control used here is a drop down control with preset options (2017,2018,2019) that requestors can choose from on submit.

9-15-2016 9-41-11 AM.png9-15-2016 9-40-24 AM.png

If the current month is greater than July then, set the control selected value as next year. Script below is self explanatory and this function is called on form load.

ID of the dropdown control is stored as ‘varFY’ and we use it to set the value of the field by using control.val(value to set).

function getFiscalYearForCurrentDate() {
try {
var today = new Date();
//alert(“Current Date:” + today);
var curMonth = today.getMonth();
var fiscalY = NWF$(“#” + varFY);
//alert(“Current Month:” + curMonth);
var curYear = today.getFullYear();
//alert(curYear);
var setFY = “”;
if (curMonth > 6) {
//0-11 for Jan-Dec. July is 6. July is starting month of our fiscal year
setFY = (today.getFullYear() + 1).toString();//current year + 1
}
else { setFY = (today.getFullYear() + 2).toString() }
fiscalY.val(setFY);
}
catch (err) { alert(err); }
}