Highlighted
Trusted Contributor.
Trusted Contributor.
1697 views

Parameterizing using evaluate javascript

Jump to solution

Hi ,

I want to user parameters by evaluate javascript option for giving input.
I tried object.setvalue="{parametername}" and
object.value=TC.getParam("parametername"), but none of it works.
can someone help me what code should is use here.

Best Regards

Vishal

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

The Generic API step was added in version 12.53.

In version 12.50 you can still call the API from your JavaScript code:

var myValue=TC.getParam("ParamName");

View solution in original post

5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi Vishal,

It is unclear what you are trying to do.
If you are trying to locate an object in the application using a value taken from a parameter and this code is going to be embedded in the Object Identification section of the step you need to use ArgsContext.TC.getParam("ParamName") concatenated to JavaScript evaluation code.

If you are trying something else please clarify in more details and attach a screenshot of the step and possibly the steps surrounding it.

Also, look at the Object Identification samples in TruClient online help. It might help as well.

Regards,
Shlomi

Highlighted
Trusted Contributor.
Trusted Contributor.

HI Shlomi,

Thanks for the quick response.

I need to set different dates in a field, but truclient wasn't recording the step , neither i was able to change the action from "click" to "type" as the option "type" was not available.
I figured it out as , I used click on the object and changed the action to "evaluate javascript", 
So I used object.value="2018.10.10"
Issue : I need to pramaterize the dates or even other criteria. so how can i parameterize it using javascript from the parameters list in table form.

Please see the attachment , I wan't to parameterize the user id here using evelaluate javascript. I am not fetching the parameter values from anywhere , but i have already created the parameters in tabular form. 
Please let me know the soultion or if you have any questions.

 

Best Regards

Vishal

 

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

You should use the TC.getParam API to extract the parameter value.

The best practice, in this case, would be to use a Generic API step to invoke this command, store the parameter value in a variable and use that value in your logic (setting the object value.

Add the Generic API step from the Toolbox manually.

See the screenshot below:

TC use param.png

Edo

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Thanks Edo for the solution,

Is the "Generic API step" available for LR 12.50? 

 

Best Regards

Vishal

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

The Generic API step was added in version 12.53.

In version 12.50 you can still call the API from your JavaScript code:

var myValue=TC.getParam("ParamName");

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.