Data Directives displaying user name in email

,

Hi,

Need help. I’m currently working on email notifications for all new transactions in our epicor. We want to display in the email the user who created or added specific job. I found a solution by using callContextClient (CurrentUserId) but my manager requested if I can make it display the user name instead of the user ID. See sample below:

Hi @Jun_Mark_Piscos
since that there is no Invoke BO method (GetById) widget in the Data Directive designer, you need to add a custom code to find your matched record within the user table which contain the Name filed then cast it to any -same type- callcontext variable that you do not use (in my code example i have used shortchar01) , then add it in your email form.

try this code, is not the best but will work:

1 Like

What @A.Baeisa said.

The reason it shows no username is because the BPM Email will run async so there is no Username it will queue it and run as the Task Agent.

EDIT:

@A.Baeisa told me that they stopped populating that field altogether, async or sync. Good to Know.

1 Like

Many thanks to you sir. I tried your codes, made a callcontext and it works.

Thanks again.

1 Like

@hkeric.wci @Jun_Mark_Piscos
as i said before that UserName does not exist within client variables, but just found today that it does exist within session variables, i have not tried it though


1 Like

Actually that makes sense, it explains why in UpdateExt I used Ice.Session instead which is a table that exists, it just wont show up in the Intellisense.

2019-05-17_1034

2 Likes

Hello @A.Baeisa ,

Sir, can you help us again with codes. Before I asked about the visibility of the username in the email notification and it worked very well. And now we want to show the server name of the epicor that the user is currently using. The reason for these is because we are still using the test and pilot server aside from live.

Hi @Jun_Mark_Piscos,
you can use this variable [ Session.AppServerURL ], assign it to a callcontext or an argument variable, then use it as it is in your email or show message, or you can substring to whatever value you want to show from this app server URL



1 Like

Thank you sir :slight_smile: . It’s working now.

:blush::blush: glad to hear that pal, but this should counts as two solutions isn’t @josecgomez ? :wink:

3 Likes

I marked two solutions already sir :slight_smile:

Thank you again.

Edit : Oh I think it’s not possible to mark 2 solutions hahah :smile:

@Jun_Mark_Piscos
improved codes instead of hard code your AppServer name length and index for each environment