Siraji Absent Member.
Absent Member.
427 views

Declaring global variable

Jump to solution

Hi,

 

Please help me variablize "name" and "description" as global variable. This XML is a header string (BODY for REST POST method).

 

<securityTag>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>XYZ</name>
<description>Demo</description>
<extendedAttributes/>
</securityTag>

 

 

Thanks,

Sam

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Absent Member.. daniel_daraban Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

You can create 2 inputs either for the operation or for the actual flow (name and description) and define the header as:

 

<securityTag>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>${name}</name>
<description>${description}</description>
<extendedAttributes/>
</securityTag>

 

In this way it will populate the header with the values that you define for your inputs.

 

Best regards,
Daniel

9 Replies
Absent Member.. mitko_bt Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

Thanks for raising this question! You may use the 'System properties', which are global flow variables with values that never change and can be used in any flow.

Please refer to the Studio Guide - 'Configuring System Properties' section for more info on this matter.

 

Let me know if this helps!

 

Regards,

Mitko

0 Likes
Siraji Absent Member.
Absent Member.

Re: Declaring global variable

Jump to solution

Hi Mitko,

 

Thanks for the reply. I understand that I will have to declare global variable in system properties however it is an XML header so wondering how can I variablize it. I can variablize a URL but not sure about an attribute of an XML header body.

 

 

Thanks,

Sam

0 Likes
Absent Member.. daniel_daraban Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

Which operation are you using?

 

Is this the request or the response header?

 

If this is the request header you can create a new result for the operation, assign it the value of your input XML header and use an Xpath or XML Get Element Value filter to take out the values that you require.

 

If this is the response header, again you can filter the response using XML Get Element Value or a XPath Query filter.

 

If you are using the InvokeMethod2 operation you can simply add a Scriptlet in it and make use of the rawXMLRequest:

 

scriptletContext.put("rawXML", scriptletRawResult['rawXMLRequest']);

 

This will add the rawXMLRequest in the Step Context and from there you can easily use a filter on the result and afterwards Set Flow Variable as the next step and grab the actual value.

 

Best regards,

Daniel

0 Likes
Siraji Absent Member.
Absent Member.

Re: Declaring global variable

Jump to solution

 

Hi Daniel,

 

Thanks for the reply. I am running POST RAW operations. I now have attached screenshots for more clarity on my query. I have variablized "nsxMagaer" here, same way I want to variablize "name" and "description" attributes of the xml header below.

 

<securityTag>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>XYZ</name>
<description>Demo</description>
<extendedAttributes/>
</securityTag>

 

Thanks,

Sam

0 Likes
Absent Member.. daniel_daraban Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

In order to extract the name and value from the string input you defined in the operation:

 

Define a result (call it name) to your operation that takes the value of the string input. For this result, create a filter using XML Get Element Value in order to get the value XYZ. Once you run the operation, it will provide a result called name with value XYZ that can be used further in your operations.

 

For the next operation, use Assign from variable and select the previously defined result (name).

 

The same goes for each pair you want to extract.

 

Hope this helps!

 

Best regards,
Daniel

0 Likes
Siraji Absent Member.
Absent Member.

Re: Declaring global variable

Jump to solution

Hi Daniel,

 

I forgot to mention that I would need to insert values for "name" and "description"  everytime I run the flow and thats the reason I want to variablize it. Just the way "nsxManager" will have different ip's everytime I run it.

 

 

thanks,

Sam

0 Likes
Absent Member.. daniel_daraban Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

You can create 2 inputs either for the operation or for the actual flow (name and description) and define the header as:

 

<securityTag>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>${name}</name>
<description>${description}</description>
<extendedAttributes/>
</securityTag>

 

In this way it will populate the header with the values that you define for your inputs.

 

Best regards,
Daniel

Siraji Absent Member.
Absent Member.

Re: Declaring global variable

Jump to solution

Hey Daniel,

 

It works like charm 🙂

 

I appreciate your help with my queries. It was nice interacting with you.

 

 

 

 

Thanks,

Sam

0 Likes
Absent Member.. daniel_daraban Absent Member..
Absent Member..

Re: Declaring global variable

Jump to solution

Hi Sam,

 

I'm glad it's working as expected.

 

Have a nice day!

 

Best regards,
Daniel

0 Likes
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.