0

I am working on an issue tracking list inside SharePoint enterprise server 2013, where it contains these fields:-

    1. “Due Date”
    1. Item status

Now our customer, asked us to implement this capability:-

When a user change the item status to be “In progress”, to change the “Due Date” to be equal to today date.

Now my question is what are the approaches I can follow within SharePoint, to implement this inside the create form, edit form & quick edit grid?

From a pure development point of view, I can write a JavaScript which fires when the item status got changed to “In progress”, and populate the “Due Date” field to be equal to today date.. But not sure how I can implement this inside SharePoint? In a way that can work on create & edit forms, and on the quick edit grid?

Thanks

  • Any reason why you would not do this using a workflow? – Alex Chance Apr 22 '16 at 15:14
  • @AlexChance Setting a workflow will not work on the fly,,, i mean if i user create/edit an item and he change the item status ,, then the Due Date will not get the new value unless he saves the item.. and i want the user to be able to change the Due Date if he want.. i mean the idea is to set the Due Date to be equal to today date,if the user change the item status to be "In progress", but users can chnage the due Date if they want.. so workflow will not work in my case – john Gu Apr 22 '16 at 17:25
  • I did not realize that was a requirement from the question. If you need that functionality prior to saving, then I believe your only options will be template overriding via JSLink. Event receiver will not work either since you need the change before item is saved. – Alex Chance Apr 22 '16 at 17:40
3

For client-side implementation, use JSLink to override field rendering. You can also add your javascript dropdown change handler to PostRender function of JSLink.

Using server side, you can use event receiver to calculate Due Date on item created and updated events.

  • ,, no need for server-side check at this stage,, but not sure how i can benefit from JSLink in my case? can you please adivce more ? does JSLINK allow me to update the field value on the fly based on another selection ? – john Gu Apr 22 '16 at 14:09
  • 1
    There are plenty of samples out there. A simple postRender handler is shown here: kogzee.wordpress.com/2013/10/21/… For quick edit, see sharepointbitsandbytes.com/2014/01/… – Aveenav Apr 22 '16 at 15:18
  • This won't work in quick edit grid – Erin L Apr 22 '16 at 15:49
  • @Aveenav thanks for the links, but before i go through them will JSLINK be able to work on quick edit as seems Erin L mentioned it will not work ? – john Gu Apr 22 '16 at 17:16
  • @ErinL can you adivce why JSLINK will not work on quick edit grid ? now i have some fields where i defined JSLINKs for them , mainly to disable them inside the quick edit grid (OnPreRender) and JSLINK seems to work inside quick edit grid.. now i did not use the PostRender but i assume it will work ... can you advice? – john Gu Apr 22 '16 at 17:19
1

Client side rendering or code to set fields won't work in datagrid view. I recommend using a workflow. Using the Wait For action (run workflow on create) is a better option than checking the status every time an item is edited.

enter image description here

  • setting a workflow will not work on the fly,,, i mean if i user create/edit an item and he change the item status ,, then the Due Date will not get the new value unless he saves the item.. and i want the user to be able to change the Due Date if he want.. i mean the idea is to set the Due Date to be equal to today date,if the user change the item status to be "In progress", but users can chnage the due Date if they want.. so workflow will not work in my case – john Gu Apr 22 '16 at 17:23
0

A simple workflow could accomplish this. enter image description here

May need to add some additional logic to prevent due date from being set again if the item is going to be modified frequently.

  • 1
    You can keep multiple updates from being an issue by using a wait for action. See my response. – Erin L Apr 22 '16 at 15:50
  • @AlexChance Setting a workflow will not work on the fly,,, i mean if i user create/edit an item and he change the item status ,, then the Due Date will not get the new value unless he saves the item.. and i want the user to be able to change the Due Date if he want.. i mean the idea is to set the Due Date to be equal to today date,if the user change the item status to be "In progress", but users can chnage the due Date if they want.. so workflow will not work in my case – john Gu Apr 22 '16 at 17:23

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.