web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How I will identified, which user submitting the workflow?

(0) ShareShare
ReportReport
Posted on by 30

Hi All,

How I will identified, which user submitting the workflow?

I passed as a parameter curUserId (). As workflow is running in batch. Shall I identified the user ,who submitting the workflow ?

Please give me more shed on this 

I have the same question (0)
  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    In workflow history you can see  who submitted workflow.

  • @rp@n Profile Picture
    30 on at

    Thanks Sukrut,

    I used the code Purctable.submittoworkflow()

    Its having few parameters, one parameter is user. I mentioned curuserid().

    Is it correct? Or is there any other way to define?

    Please give me more shed on this

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Yes, you can use it this way if the current user will submit the workflow.

    However, if you are going to do these operations with batch, you can specify the user to submit the workflow with the code and give the relevant user as a parameter.

  • @rp@n Profile Picture
    30 on at

    Thanks Ergun,

    Kindly let me know how I will define the user as parameter in batch operation?

    Please send me the code. That I am looking for.

    Please give me more shed on this

    Thanks!

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    First you need to determine which user to use. This is a process issue, you have to make the decision, but if you ask my opinion;

    You can use purchTable.CreatedBy or purchTable.WorkerPurchPlacer (if its full).

    CreatedBy holds the userId, so you can use it in the code. For the Worker field, you can get userId;

    userId = HCMWorker::findPersonUser(purchTable.WorkerPurchPlacer).User;

  • @rp@n Profile Picture
    30 on at

    Thanks Ergun

    As you said,"You can use purchTable.CreatedBy or purchTable.WorkerPurchPlacer (if its full)"

    What do you mean

    WorkerPurchPlacer (if its full)" ? Kindly elaborate please 

    Please give me more shed on this 

    Thanks!

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    There are many cases where this field is empty or not associated with the employee you want (such as CurUserId not associated with a user, creating records with batches or creating records with custom codes etc.)

    Before you decide to use this field, it is useful to examine the records in the table and check whether it contains the information you want.

  • @rp@n Profile Picture
    30 on at

    Thanks Ergun

    1.operation with batch to submit workflow,  these 2 fields -

    purchTable.CreatedBy or purchTable.WorkerPurchPlacer  

    Only we can use? To capture who submitting the workflow ?

    2. But before using any fields, we need to check business requirements which fields get fit as per our requirements.

    Am I correct?

    Please give me more shed on this

    Thanks !

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Yes, but as I said before, it's about the process, you have to decide which user should start the workflow.

    I think it is most logical to use the user who created(createdby) this table record.

    If you use the worker field there is possibilty changing user later but you can't change createdby field (of course for records that are not sent to the workflow)

    If the records you want to send to worflow are created by batch, one of these two fields will be empty(or batchUserWorker) and the other will be batch user Id. In this case, it is necessary to look at alternative fields.

    You don't have to use either of these two fields. There are similar fields on Vendor or item.

    It is also possible to use a batchUserId(curUserId) or a UserId to be defined in the parameters, (with this logic you can known the workflows was created by batchjob.)

  • @rp@n Profile Picture
    30 on at

    Thanks Ergun,

    I have also used before curUserId as parameter. But I couldn't proof, is it batch user I'd ir normal user I'd. It is talking my user I'd as curUserId.

    As you said

    "also possible to use a batchUserId(curUserId) or a UserId to be defined in the parameters, (with this logic you can known the workflows was created by batchjob.)"

    *** How can I justified,  the userid is batch userid or not?

    Becuse as per business logic , I need to pass parameter batch user I'd only while submitting the WF.

    Please give me more shed on this

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans