You are viewing limited content. For full access, please sign in.

Question

Question

Remove Domain Name from {/_currentuser} Token

asked on October 21, 2015

Hello,

I have a form that is using a lookup into a table of usernames.  When I use the {/_currentuser} token in forms, it also pulls the domain name.  What is the code to strip the domain out, leaving only the username?  

Also the {/dataset/_initiator} doesn't populate the field with any data at all.  

0 0

Answer

SELECTED ANSWER
replied on October 21, 2015 Show version history

Create a field (q1) that will use the default value, {/_currentuser}. Then using JS, you can modify the string to only use the username.

$(document).ready(function () {
  $('#q1 input').val($('#q1 input').val().substr($('#q1 input').val().lastIndexOf('\\') + 1));
});
1 0

Replies

replied on October 21, 2015 Show version history

Our domain is ALL\user.name, I just use the regular expression "\\(.*)" in the token dialogue, which grabs everything after the \.

replied on October 21, 2015

Thanks Alex!  That worked.  

0 0
replied on October 26, 2015

Hi there,

The initiator doesn't pull any name if you haven't submitted the start form is expected, because there's no initiator yet.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.