Skip to main content

Hi,

 

I'm customising the email sent to the Manager (Participant) but the Manager email comes out as "surname,firstname,"

 

In the Workflow notification to the Manager (for Approval) i'm using the Work item context field - "Participant Name", but when the Manager receives the email, their name is being displayed in the e-mail as Dear surname, firstname,

 

I know how to format the user filling in the form using expressions (concat etc)  (thanks to helpful peeps on here) but I don't know how to do this in a Workflow Email when referencing the Manager (participant)

 

Any ideas?

If you use DisplayName from your AD SmO, it will appear as First Name Last Name.


Hi,

 

That won't work, because the Approver (Participant) is not in a Smartobject.

I'm doing this in a Workflow, and use Context browser to grab the Approver and put then in a Task Group. Only the End-user name (who fills in the details) is in the Smartobject.


Hi,


 


Can you clarify what you mean by "Workflow Email"? There are two workflow events, the email event and the client task notification. I'm assuming you are using the client task notification, but can you verify?


 


 


Hi,

 

This is under the User Task (Smartforms) User Form (Event notification settings) - it looks like an email customisation page.

 

Then go to context browser, work item context - "Participant Name"

 

When i use that variable in the body of the email message, it comes out as surname, firstname (when the Approver receives it)


As @JakeCooley mentioned, this typically comes from Active Directory.  If you can assign a task to a user (which I'm guessing you can because they get an email stating they have a task), then it is a SmartObject.

 

More specifically, this information is provided by the security label used when the task is assigned.  The stock K2 security label uses AD to get user information.  There are other stock security label providers for SharePoint, SalesForce.com and more.  You can even write your own if need be.

 

Whatever your provider is, it must return a property for all users called DisplayName.  This is the name you are trying to change in emails.


I dont know if i understand this correctly but lets see if this helps. The Participant Name is basically the display name that is stored in Active Directory. You have two optios either change the AD display name field to right order or format the Participant Name string to make it show the right way round.

 

To make the Surname Firstname switch order what you can do is either add a code event in you workflow that takes the value of the participant name and formats it and then store it to a datafield that you can use in the email event or use the built in functions to manipulate the participant name. The server event seems the easient for me.

 

So someting like if the name is currently showing as surname, firstname then just use the comma to get the right hand side and left hand side. If theere is no comma just trim the string at the start and then use the space instead of the comma in the below example;

 

string cleanName = K2.ActivityInstanceDestination.User.DisplayName;
string firstname = cleanName.Substring(cleanName.LastIndexOf(@",") + 1).Trim();
string surname = cleanName.Substring(0, cleanName.LastIndexOf(@",")).Trim();


K2.ProcessInstance.DataFieldsl"DatafieldName"].Value = firstname + " " + surname;

 

Hope this helps a little.

 

 


Thanks someone,

 

My workflow has a User Task (Smartforms) which is where the Participant is selected and the notification is setup.

Is that where I insert your code (in the body of the notification)?

 

I can't see where I could add a code event?


I see, Is the activity setup with multiple destinations or just one destination user. If you only have one destination for that activity then you can jsut add a server event veore the task event and add the above bit of code there and then just drag the datafield into the email event of your task.

 

If this activity has multiple destinations then the data field would e overwritten by one of the instances of the activity that run i parallel. In this case you would have to somehow manipulate the participant name directly on the email event of the task using the built in k2 functions.


Hi,

 

The activity has multiple destinations. The end-user fills in the form, the workflow checks the Department and send it to the Manager for that department to Approve.

 

On the User Form (within User Task Workflow) there are Inline functions under context browser, but not sure if you can using them on the actual notification message itself.

 


No, you wouldnt be able to use the code method i the email event itself. You would have to use the built in functions of K2 to somehow figure out the right combination of method.  


Hey all,

 

So close to nailing this, I'm now shifted to using K2 Studio for doing this.

 

I have the Displayname of the Approver in a K2 Studio DATAFIELD called "Displayname" (If i add this datafield to my email notification, it comes out "Bloggs, Fred"

 

Can someone please tell me how using K2 Studio functions I can swap these two around and remove the comma? - So it reads just Fred Bloggs

 

I've played with the functions, but none work.

 

If I can get this sorted, i'd be delighted.

 

Thanks

 

 


Looking at the methods avaialble I dont know if it is posisble. Just out of curiousity, is athere a reason that the display name is stored in active directory as surname, lastname than the usual firstname lastname. I wouldve thought that was the whole point of having a display name in AD so you show the name of the user in the right order. The best method (if feasible) would be to change this display name attribute in AD.  


I too have this issue, some of us don't have the luxury of changing the way names are setup in Active Directory nor can we easily change them.  So the question remains...how does one get portions of the participant name in a Workflow email?  Even jsut the last name woudl suffice so I could say Mr. or Ms. ParticipantLastName.  There appears to be no easy way to do this.


Reply