Can i fetch Role of a employee in sales order if i have the employee id

How can i check the employee has some role example “cm1” .
i want to check that inside customer doc type in there i have emp_id ,if cm1 is there i want to make a field as wish

Can you provide more context about how you customized the customer doctype? For example, are you using a Link field type to link the employee to the customer, or are you using a different data type? Understanding how you’ve structured your customization will help in providing a more tailored solution.

here you can see i have given george have role ZM1

this is from customer , here i need to validate which Zonal Manager role he have ZM1 or ZM2 or ZM3 . here we can see he have ZM1 role
so i will create a new custom field and need to populate which zonal manager role he have

Based on your description, it seems like you are maintaining Zonal Managers as a separate doctype. If this is the case, you can create a new custom field in the Customer doctype to populate the Zonal Manager role.

First, ensure that you have a “Role” field in the Zonal Manager doctype, and link it to the Role doctype. Then, set the appropriate role for each Zonal Manager entry.

Next, in the Customer doctype, you can utilize Frappe’s fetch from feature to populate the Zonal Manager role field. Here’s a general outline of how you can do this:

  1. Add a new custom field to the Customer doctype to store the Zonal Manager role.
  2. In the Custom Script for the Customer doctype, use the fetch from feature to fetch the Zonal Manager role from the linked Zonal Manager entry.

If you are not maintaining Zonal Managers as a separate doctype, please provide further information on where the Zonal Manager information comes from so that I can assist you accordingly.

No i not keep a doctype for zonal managers
I get zonal manager from employees

If you’re fetching Zonal Managers from the Employees doctype, you can utilize the Employee Type field. Create an Employee Type with names corresponding to your Zonal Manager roles (e.g., ZM1, ZM2, ZM3). Then, assign the appropriate Employee Type to each Employee. For more information about the Employee Type doctype, you can visit this link. After setting up the Employee Type field, you can proceed with creating a custom field in the Customer doctype to store the Zonal Manager role. Use the fetch from feature to fetch the Employee’s Employee Type into this custom field. However, if you prefer not to use the Employee Type field or have specific requirements, please let me know, and we can discuss alternative solutions

can get the roles using any another field in employee(eg employee name)

You can indeed fetch roles using any other field in the Employee doctype, such as the Employee Name, using the fetch from feature in Frappe. However, in your scenario, the Employee Type field seems most suitable. If you’d like to explore alternatives, you can customize the Employee doctype and add fields as needed, then fetch them accordingly

i have added a zonal manager doc type and added the employees there
after i done my work flow this is the message showing in sales order

Have you created a new doctype for Zonal Manager?

yes ihave created a new doctype for zonal manager where we manually add manager and zone
zone is ZM1

can any one say why this happening

It looks like a permission issue. Please ensure you have set the correct permissions for your doctype. For more information, please refer to this link