1

I am currently working on SharePoint 2016 on premises,

I have a situation where in the root site, I have a list A which has a content type X and one of the fields is counter (starts with 1). From a sub-site there is another list B, which has a lookup to List A, when a user creates an item on list B the counter related to the item in List A should be updated. I am trying to see the different options I have. The problem is I cannot use provider hosted apps since it is against policies so no event receivers can be created via server side code.

I was thinking of doing this via workflow via SPD, can anyone tell me if this is a good idea, and if yes provide me with some knowledge on this since I have never done any workflows before.

IanCian
  • 256
  • 1
  • 5
  • 18

1 Answers1

0
  1. One way I see is you can customize your subsite list B forms.

    In that you will add your script and update items of root site list A items.

    Script will have PreSaveAction method which will be called when you add/update item.

    Inside that method you can get item from the root site list A and update its value as per your need.

    Look here for code snippets for How to: Create, Update, and Delete List Items Using JavaScript

  2. The other way you could use is workflow. Here is the steps to Create a workflow for SharePoint.

    Once you are able to create workflow you can see here for more info about How you can update list item in worklfow.

    Also check this link: How to make workflow update another list item based on a calculation.

In my opinion I would prefer first option. But you can go ahead with any you would like as both options are good to go. There might be other ways also available but I feel this are two best options for you.

Hope this helps!

Pradip R.
  • 2,297
  • 2
  • 16
  • 39
  • I will try to check about option 1, since option 2 would need that I would use rest services via a workflow, since list A resides in a root web, the SPD would not let me update it that easily. Also regarding Option 1, I want to update list A listItem counter, once an item is saved. I doubt that the PreSaveActions will help in this case. Are there any after save methods related, without having to rewrite all the saving functionality in the custom form? – IanCian Jul 06 '17 at 08:48
  • https://sharepoint.stackexchange.com/questions/91854/what-is-the-difference-between-presaveaction-and-presaveitem-on-sharepoint-l Check this thread. – Pradip R. Jul 06 '17 at 09:50
  • When you update item in list B. Update form there (for list B only), specify PreSaveAction or PreSaveItem as per your need and update list A entry by REST or JSOM. This should work for your requirement. – Pradip R. Jul 06 '17 at 09:52