2

Suppose I have an Appointment Object, which has

Date, Specialization (picklist), and Patient(Master object-record type of standard object, Contact)

I have another object, Visit, which also have the exact same fields, in addition to a Doctor field(record type of standard object, Contact) Doctor has specialization, required.

When patient fills Appointment object, I want a workflow which auto-populates the doctor field in Visit object, matching the Specialization Picklist in Appointment, with the one in Doctor.

Is there any way to do this? Also, what data type do I set for doctor?

I am extremely new to Salesforce and know very little

1

So as of now, I would suggest you to go with simple Apex code that created a Visit record and picks up the doctor on the basis of specialization. The relationship and field type is fine (lookup). You might also think of linking Visit and Appointment.

Looking into future expansion in mind, it is good that the solution that you apply is always scalable.

Ex-

What if there are multiple doctors with same specialization?
What if doctor is not available when the appointment is booked ?
What if doctor has more than one specialization?

2

Unfortunately there is no way to use WorkFlow to update a Lookup field.
Only if your Data type for Doctor will be text you will be able to update the field with the value you want even from the parent record Using WF.

But another option is to use URL Hack on the create button which will populate the Doctor field with the Id (popualte a lookup).

I believe you can do it with the new Lightning Process builder as well..

and of course - if those option are insufficient from some reason you can jump into code and achieve you goals..

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.