Updating SharePoint column on create or modify based on another list


Badge +11

I am using SharePoint 2013 and Nintex Workflows 2013. I have List A and List B. Both of them are in the same site. I want a Total field from List A to be displayed in the List B SharePoint form based on criteria. I also don't want the user to be able to save the form if an Amount field is greater than the Total field that was bought over from List A. I need this to happen on Create and Modify. How can I do this? Please give me code and screenshots if possible.

I hope this makes sense.

Thanks in advance!!!!


5 replies

Badge +8

Hi,

We could approach this via a calculated field and adding validation against the calculated field.

List 1 - MaxLimitValue (List A) which has details of the total value to validate against

   Column 1 - Title

   Column 2 -  MaxTxnValue

List 2 (List B) where the validation needs to take place

Customise this list using Nintex form and add a calculate column.

202693_pastedImage_1.png

1) Calculated field formulae - lookup('MaxLimitvalue','Title','1','MaxTxnValue')

   Where MaxLimitValue - List name (List 1)

               Title - Column title

                1 - Value for which the max value needs to be returned

                MaxTxnvalue - The value of the field which needs to be validated (Total Value in your case)

2) add a validation rule to the Amount field which needs to validate against the total field (which looks up value from List 1)

202697_pastedImage_2.png

let me know if this is clear?

Regards,

Shrini

Badge +11

I am using a SharePoint form.

Badge +8

Okies as this question was on Nintex forum I assumed you were using Nintex forms...

What tools do you have access to? Do you have Infopath? 

Or do you have visual studio and may be create some webPart which could be used to add rows into your List 2?

Badge +11

No, I do not have access to Visual Studio. We have InfoPath 2013 but they prefer that we don't use it since we don't know the future of it. So, I am using SharePoint 2013 Forms and Nintex Workflow 2013. I could possibly use JavaScript to try and help but I don't know how to make that connection from List A to List B.

Badge +8

Hi,

sorry wasn't around yesterday ..

I believe it could get a bit tricky if you don't have Visual studio as it would be quite useful in customising.

if you want to use JavaScript you could use CSOM to get the list data, some samples below, but I still believe you would have issues in attaching it to the control as the control IDs get dynamically generated by SharePoint. You could still get the values and validate and may be raise an alert but the user experience wont be that great ..

How to: Retrieve List Items Using JavaScript 

Another option (I am sure you would have already thought of) could be if you do a delay validation of this element via workflow and revert it back if the values are not correct?

Regards,

Shrini

Reply