Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Cannot resolve variable in EVAL () in Pattern Designer

GKanekar
Tera Expert

Hello Experts,

 

I am new to Pattern Designer and I am trying to extend the Windows OS Pattern to augment the Windows Server with the Domain Role information using the below command

wmic.exe ComputerSystem get DomainRole.

 This gives back a number and the number determines the Server role in a domain.

 

I am able to set this number to a custom field that I have created on the cmdb_ci_win_server table. I am trying to further refine the pattern by converting the number to a proper string (like 0 = Standalone Workstation, 1 = Member Workstation etc) and this is where I am unable to get the "Set Parameter Value" working. Basically, I am unable to resolve the variable $tmpvar (set successfully in the previous step) in the EVAL() function.

 

Below are the screenshots for steps.

GKanekar_0-1725437654159.png

GKanekar_1-1725437716135.png

GKanekar_2-1725437812808.png

 

Would appreciate your help here.

 

Thanks in advance. 

 

 

1 ACCEPTED SOLUTION

GKanekar
Tera Expert

Hi All,

 

I finally got this to work. As it turned out the problem was with the second step where I used $tmptable[*].DomainRole this created a variable (tempvar) of a type table with a single cell instead of a string variable.

Changing the table value at parse step to $tmptable[1].DomainRole (the output from the previous WMI command is always a single row) did the trick.

View solution in original post

1 REPLY 1

GKanekar
Tera Expert

Hi All,

 

I finally got this to work. As it turned out the problem was with the second step where I used $tmptable[*].DomainRole this created a variable (tempvar) of a type table with a single cell instead of a string variable.

Changing the table value at parse step to $tmptable[1].DomainRole (the output from the previous WMI command is always a single row) did the trick.