0

I have two lists: one is a list of customers, and one is a list of service calls.

The customer list has [Driving Distance], which is the distance from our central office to their office; likewise, the service call list has [Travel Start Time] and [Mileage] for our employees to document their travel.

Now, here's my idea: when an employee creates a new service call, if they had to travel, take a guess at the mileage. I've already tried setting [Mileage]'s default value to this calculated formula:

=IF(ISBLANK([Travel Start Time]),
    "",
    [Client:Driving Distance]
)

However, SharePoint just threw an error back at me, saying that [Client:Driving Distance] didn't exist. (I know it exists, but I guess I can't use it in a calculated column.)

Is there any way to implement my idea? If SPF2010 has a JSON API, I'm not familiar with it.

0

You cannot use a Column reference from a different list for calculations. Calculated columns can only reference columns from the same list.

You could use Event handlers though.

0

I am assuming you created a lookup column in the Service Calls list that is called "Client" and have checked the box to also show the "Driving Distance" field in the column settings.

Using a Workflow in SharePoint Designer (set to start on item creation only) you can fill in the Mileage field based on the value of your lookup column. Use the "Update field in current item" action and select your "Client:Driving Distance" field as the value.

  • Your assumption is correct, but I want the Mileage field to be automatically populated when a Client is picked or changed, well before the item is saved. I know I'll need JavaScript of some kind, but I'm not sure if SP(F)2010 will do that. – reversedelta Mar 30 '15 at 21:44
  • A calculated column will not update before save or update either. So indeed you will need JS. Please add to your question you want the field to be filled before save. – Jan Jouke Tjalsma Mar 31 '15 at 4:56

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.