Want to check user Designation in Purchase Requisition Workflow in D365 F&O?

Basically, I want to check that Preparer is Project Manager or not. I have to add a field in Dropdown to check this condition.

I have done a lot of R&D but unable to find the class or field where I have to code the logic.

Can you please help me in letting me know where I have to code

?

What exactly do you mean by “Preparer is Project Manager”? Is it a property of the preparer? Or is Project Manager a field on the requisition? Or do you want to take it from a related project? Or something else?

I want to check that the person who is preparing the PR, is Project Manager or not. Means his Job title is “Project Manager” or Not.

All right, so you want information that you currently don’t have in the workflow document and therefore you’ll have to add it. I suggest you simply add a calculated field (parm method) to the document class.

Also note that hard-coding business data (such as position names) isn’t a good idea - think about a design that can survive different setup, such as position names translated to another language.

Martin, that thing only I don’t know how to add that Calculated field and Mainly on which class I have to Add that field?

Let me teach you how to find it out. In Application Explorer, expand Business Process and Workflow > Workflow Types and find the one for purchase requisitions. I think you want PurchReqReview. Then look at its Document property - the value is the workflow document class. It’s PurchReqDocument class in this case.
If you open the class, you’ll see examples of calculated fields, such as parmSpendingLimit().

Martin, I have done all the above class and I have found parmSpendingLimit() also. So what all further steps I have to follow after there to add a new field in the dropdown menu?

As the first step, think about what exactly you want to return. This will tell you what will be the name of the field, the return data type and what logic should be inside. For instance, you may want to simply return a boolean flag indicating that the preparer is a project manager.

Martin in return I want the Job Title (Mainly Project Manager) of the Preparer.

Can you please help me with the Logic as I don’t have that good technical Knowledge to create the Logic or the same. What all parameter I have to pass and all that thing.

Your design doesn’t take into account the fact that a single person can have multiple positions at once. You want to return a single title, but then you would have to somehow pick just one of the positions.

Martin, I have to code the whole logic in the PurchReqDocument.xpp ??? or should I extend this class?

What is the process that needs to be followed for checking the preparer Designation to display the field in DropDown means what all PARAMETERS should I take into consideration while CODING?

You can’t modify standard objects - you must extend them.

Before coding anything, design something that can be implemented. I described the bug in your current design in my previous reply. You should either use my original suggestion, return a list of all positions or somehow select a single position (but I don’t see any good way how to do it, therefore it doesn’t sound reasonable to me).

Hey Martin

I have added a field by extending the PurchReqTable, now I am able to see Purchase requisition. Projectmanager in the Drop downfield.
But I haven’t done any backend coding just extended the field.

So what all the next steps I have to follow for configuring it and make it properly working.

It depends what you what the field to represent. Please make sure your address the problem that I explained in my last two replies.

For reference, there is a duplicate thread in the Community forum about the same question.