FlowDesigner javascript:gs.getUserID() in IF logic not working

Siva82
Tera Expert

Hi All,

 

Flow Designer javascript:gs.getUserID() in IF logic not working

 

Please refer the attachment.

Can please help me on that.

 

Siva82_0-1691042461986.png

Siva82_0-1691043308125.png

 

 

8 REPLIES 8

nameisnani
Mega Sage

Hi @Siva82 

 

The reason why the gs.getUserID() in IF logic is not working in the Flow Designer image you sent is because the IF statement is checking for the value of the variable "userID". However, the variable "userID" is not defined in the Flow Designer image.

To fix this, you need to define the variable "userID" in the Flow Designer image. You can do this by adding the following code to the Flow Designer image:

var userID = gs.getUserID();

Once you have defined the variable "userID", you can use it in the IF statement. The IF statement will then check for the value of the variable "userID" and execute the code in the THEN clause if the value of the variable "userID" is equal to the value you specify in the IF statement.

For example, you could use the following IF statement to check if the current user is the owner of the incident:

if (userID == incident.owner) {
  // Do something
}

If the current user is the owner of the incident, the code in the THEN clause will be executed. If the current user is not the owner of the incident, the code in the THEN clause will not be executed.

 

Please mark the answer as correct solution and helpful if helped.

 

Hi @nameisnani 

Thank you for quick response,

There is no script option in the  IF logic.How to use code which is provided

Siva82_1-1691044126358.png

 

 Thank you

Hi @Siva82 

 

As per the new features of community, you can accept multiple solutions as correct!