Is there a way to automatically set the Sale Rep 1 combo box based on the current user log?
There are several ways to do this depending on when you want to set it and if you want it to be changeable.
Are you wanting to set it as the default when a new record is created? I’d do a post processing bpm on the getnew method for this record.
Want it to be set automatically to the current user when the record is saved? I’d do a pre-processing bpm on the update method for this record.
If you want it set for a different scenario let us know what it is and we can point you in the right direction.
Hi Cory I want it to be default only when new order record is created and also changeable. Thank you Cory.
Hi Cory I notice that it was getting the list from the Workforce?
I’d create a post-processing bpm on SalesOrder.GetNewOrderHed and then use a set field widget to set that specific field (OrderHed.SalesRepCode1) to the work force account associated with the current user.
You’ll have to write a linq expression for that and you’ll have to go from the BPMCallContextData.CurrentUser to Person/Contact with the userID and from person contact to work force using the perconID to get the work force ID.
Yea you’re expression will need to be something like this. I didn’t actually test this I just took a similar expression of mine and rewrote tables and fields.
(string)Db.SalesRep
.Where(sr => sr.PerConID ==
(Db.PerCon
.Where(p => p.DcdUserID == callContextClient.CurrentUserId)
.Select(p => p.PerConID)
.FirstOrDefault()))
.Select(sr => sr.SalesRepCode)
.FirstOrDefault()
thanks, i tried the code it didn’t work. I will try again.
I went ahead and set the whole thing up in my test site and it worked. Show me your whole bpm.
That looks the same as mine. What about yours didn’t work? Do you have a work force account that’s linked to your User ID through person/contact?
Is it automatically link to person and contact if I created a workforce?
Thank you Chris I will try it immediately
I did check and set it, but still not working
This does not link automatically. You’ll need to verify that your work force account is linked to your person/contact ID and than your person/contact record is linked to your userID.










