Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Last activity: 28 Aug 2018 9:35 EDT
I want to set Clipboard Property to a Variable in js,which is not working
Hi Team.
Issue:Need to set a clipboard page property to variable in js.Given below in js.
var testvar = '<%= tools.findPage("pxRequestor").getIfPresent(".pxReqLocale").getStringValue(); %>';
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Team,
Thanks for resolving SR.
This is resolved by variables are set into Pega Rule "UserWorkForm" by customizing it.
Regards
Aswana
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
US
Aswana,
Your image did not show up in your post, perhaps you could re-upload or write out the alert output. Also please let us know what version of Pega you are using as this could affect the answer.
I would like to know why you are trying to set a clipboard value using js? Assuming a recent version of Pega there are probably better ways to accomplish what you are trying to do that work more within the guardrails.
Sincerely,
Cecil Howell
Senior Technical Instructor, Pega
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Cecil,
I need to implement GTm Functionality in my application.
I called the function in a text file and called from Harness.But in the analytics graph i need set the page views with page names.For that i need to set the variable before calling this function.But i cant set var(ex.Locale).
In alert the syntax itself throwing as alert.
Hope this helps.
Regards
Aswana
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689877000/122ddbf9-8ed7-431e-8c0c-0892f658c39d.png?itok=HwmzfVHs)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689877000/122ddbf9-8ed7-431e-8c0c-0892f658c39d.png?itok=HwmzfVHs)
Pegasystems Inc.
US
Can you try setting to a "ClipboardProperty" instead of "var", i mean in Scriptlet first. For example,
ClipboardProperty value= tools.findPage("WorkPage").getProperty("test");
Then setting it to var. First check whether value is not empty. You can use oLog.infoForced("Value="+value);
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Rachit,
I am getting below syntax error on this.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/ea0db37c-0cf3-4f6a-90e5-7fa31ed4f3cf.jpg?itok=pvfvIWNy)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/ea0db37c-0cf3-4f6a-90e5-7fa31ed4f3cf.jpg?itok=pvfvIWNy)
Vodafone
IN
Hello Aswana,
I have gone through the issue, I found there is an extra ';' which is an obstucle in declaring the value to variable.
Use the below, this will work fine.
var testvar = '<%= tools.findPage("pxRequestor").getIfPresent(".pxReqLocale").getStringValue() %>';
Reason: ';' is take to next line.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Naveen,
throwing same error.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
CollabPartnerz
IN
Hi Aswana,
Please follow below link.
https://collaborate.pega.com/question/copy-property-value-clipboard-variable-using-javascript
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Gaya,
I have seen this link from PDN,But which was not working.
Regards
Aswana
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Team,
Waiting for an Update.
Regards
Aswana
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Marissa,
Waiting for an update on this.
Regards
Aswana
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
US
Try using the code in an html rule referenced in your harness, such as a non-autogenerated section or control.
I tried a non-autogenerated section and it displayed properly with this code.
<script>
var testvar = '<%= tools.findPage("pxRequestor").getIfPresent(".pxReqLocale").getStringValue() %>';
alert(testvar);
</script>
-
Subashini Ananthakumar GOKUL PRASATH S VIGNESH L
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Carissa,
Hi Carissa,
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Marissa,
Hi Marissa,
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-07/f7f35052-5e7d-4ed9-ada9-87594f1d3c63.png?itok=bz3Ms_gZ)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-07/f7f35052-5e7d-4ed9-ada9-87594f1d3c63.png?itok=bz3Ms_gZ)
Pegasystems Inc.
US
Hi Aswana!
I see that you're working on this via your SR. Please update this thread with your resolution once it's met.
Thank you!
Accepted Solution
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
TCSL
IN
Hi Team,
Thanks for resolving SR.
This is resolved by variables are set into Pega Rule "UserWorkForm" by customizing it.
Regards
Aswana