Trying to dot walk record producer variable in workflow

josh_the_tech
Kilo Expert

Hi,

 

I'm currently having an issue with dot walking in a workflow.

I've got a form for leavers, where they user types in the name. It references the sys_user table and has secondary lookup fields (name, user_name, employee_number) which allows the user to pick the correct leaver.

I then want to grab just the username and put it into a email message that goes to our automation system (ThinkAutomation) so it can expire the account. I can successfully expire the account but I can't get it to dot walk reference the username.

 

The field they fill in is called leavers_name and the field in sys_user I want to reference is user_name.

I've tried a combination of different variables I've seen when looking on the community but none have been successful.

 

The email is formatted as:

Username: ${current.variables.leavers_name.user_name}
Leave Date: ${current.variables.u_leavedate}

 

I've also tried ${current.variables.leavers_name.user_name.toString()} and I've also tried ${current.request_item.variables.leavers_name.user_name} to no avail.

If anyone can point me in the right direction, I'd be most grateful.

 

Thanks in advance!

 

Josh

1 ACCEPTED SOLUTION

josh_the_tech
Kilo Expert

I've discovered the issue was that I was using a Lookup Select Box, rather than a Reference.

 

So to confirm, to dot walk, you must use a Reference box. Then you can use a normal variable like ${current.variables.leavers_name.user_name}

 

Thanks all for your comments and suggestions. I've put this in, in the hope others will benefit from it.

View solution in original post

10 REPLIES 10

In workflow add to your code gs.info('expected output user name: ' + current.variables.leavers_name.user_name). Make sure that all necessary activities are executed (see the 'show workflow' in RITM related link). Search for the log created earlier, after you run workflow once. As soon as you get the output you should be able to understand where something is broken.

Phuong Nguyen
Kilo Guru

Hi Josh,

Which table is this notification on? and is it a record in the notification table or is it a workflow activity?

Thanks,

Phuong

Hi Phuong,

The workflow/notification runs on the Incident table. The notification is a workflow activity based on the incident generated by the Record Producer.

find_real_file.png

 

asifnoor
Kilo Patron

Hi,

When you print ${current.variables.leavers_name}, are you getting the user sys_id?

If yes, then try like this

${gs.getUserNameByUserID(current.variables.leavers_name)}

Mark the comment as a correct answer and helpful if this works.

 

Sorry this hasn't worked, even by changing the field in the record producer to look up by SysID. Ideally we need to get full name as it prints the full name into the short description using producer.leavers_name (the record producer variable name).