4 followers Follow

Question: How can I check if a password is provided on a user input task?


I would like to check if a password is provided on a user input task.

I am thinking creating a custom task "Check valid password" that runs after the user input task.

But i don't know how to check the password value...


Any ideas?


Thank you,


Edgar Fernandes

Please sign in to leave a comment.



Hi Edgar

You can create a custom task that checks the password and fails if it is not set.

Here is some prototype code:

In ext/synthetic.xml:

<type type="test.PasswordCheck" extends="xlrelease.PythonScript">
    <property name="password" category="input" password="true"/>

Add ext/test/

import sys

if password == '':
    print "Password may not be empty."
Hes Siemelink 0 votes

Hi Hes,

Thank you for your answer.

But in your prototype, we need to fill in the password again.

Do you know how to check password already entered on user input task?

Thank you,Edgar

Edgar Fernandes 0 votes

On the community i saw something like that :

# Get the desired key from the MapStr
def getMapValue(sKeyName,sMapStr):
  iTagEndPos = sMapStr.find(sKeyName) + len(sKeyName)
  iFindNextEq = sMapStr.find("=",iTagEndPos)
  iFindEltEnd = sMapStr.find(",",iFindNextEq)
  if iFindEltEnd == -1:
    iFindEltEnd = sMapStr.find("}",iFindNextEq)
  sFindValue = sMapStr[iFindNextEq+1:iFindEltEnd]
  return sFindValue

# Get our password value from the Release Password Map
val = getMapValue(password,str(release.passwordVariableValues))

It looks like what i am looking for, but val equals :

{${PASSWORD}: MyPass!

and I only want :


By adding :

val.split(": ")[1]

I got what i wanted.


Do you have a solution more simple?


Edgar Fernandes 0 votes

You will have a password variable, let's say ${mypass}

Then you configure the User Input task to ask for a password and store it in ${mypass}

This variable can be passed into the PasswordCheck task. In the PasswordCheck task, switch to password field to variable mode and select ${mypass} from the list.

Hope this helps!

Hes Siemelink 0 votes

Thank you Hes,

It's working!

But not exactly as expected.

If no value is provided for the password variable, i get this message :

"The task could not start because the following variables could not be replaced: ${MYVAR}. Ensure that global variables are defined, password variables are only used in password fields, and other variables are only used in non-password fields."

So, the script never displays the message :

"Password may not be empty."
Edgar Fernandes 0 votes

Make sure password=true on the synthetic.xml and the variable is of type password.

Does this help?

Hes Siemelink 0 votes

This my task on the synthetix.xml file :

<type type="release.CheckPassword" extends="xlrelease.PythonScript">
    <property name="password" category="input" required="true" password="true" description="Select password variable"/>
    <property name="iconLocation" default="release/xl-release.png" hidden="true"/>
    <property name="taskColor" hidden="true" default="#A9207D"/>


And this is my task on the UI :



Edgar Fernandes 0 votes

If you want to make sure the password is not empty, the best way is to create a password variable, say MyPass, that has the option "Required", but not "Show on Create Release form".

Now there are to options to have the user fill in the MyPass password during the release.

  1. Configure the variable MyPass on the tasks that need it. The release will start, and the first task that needs it will go into "Needs input" state. Even though this would be an automated task, the user is requested to fill in the value of the MyPass password before the task can start. The password value is stored in the variable MyPass and used in subsequent tasks without user interaction.
  2. Configure a User Input task that asks for the MyPass variable. It is not allowed to complete a task with an empty value.

I hope this solves your use case.

Kind regards,

Hes Siemelink 1 vote

Hi, that's currently what i am using to check if password variable is empty.

Thank you for the answer (even 9 month later ;-) )

Edgar Fernandes 0 votes