Can we retrieve value from clipboard using JavaScript API?

Can we retrieve value from clipboard using JavaScript API ?

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

December 8, 2015 - 1:01am

Yes Rasaiya. Here are 2 ways for your reference. Give a try in a HTML control or a HTML rule and see the syntax & all. Check this OOTB rule: ActionDropDown, AddWork



var testvar = "<%= tools.findPage("OperatorID").getProperty(".pyUserIdentifier").getStringValue(); %>";

alert("Operator ID:"+testvar);



<script for="window" event="onload">var testvar = "<pega:reference name="OperatorID.pyUserIdentifier"/>";


December 8, 2015 - 1:07am
Response to Ravi Kumar Pisupati

Will try and share the results ☺

December 8, 2015 - 5:31am
Response to Ravi Kumar Pisupati

Hi Ravi ,

This question is for knowledge purpose.

It worked, but problem is, it is set only once.

consider the following code.

/////////////////////////////////code starts here

run a activity through js which sets a property in the clipboard.

If the value set in the clipboard s A

         then  do Action 1


         do Action 2

/////////////////////////////////code ends here

If I put the above code in the function in the html rule and call it twice.

It executes the action that is executed first time twice even if the value in the clipboard has changed.

December 8, 2015 - 7:01am
Response to RasaiyaNadar


Yes that is true. The scriplet will get executed only when the JS is getting loaded and not always when the JS function is called.

So incase you need to get fresh data again, you may need to refresh the section having the jS code i.e. reload it.

December 8, 2015 - 7:51am
Response to Ravi Kumar Pisupati

Hi Ravi, useful for me! One question: do you have a hint where I can find a good documentation on these objects (tools) and methods (findPage, getProperty etc) that I can share with my customer?

December 8, 2015 - 9:40am

December 8, 2015 - 10:09am


Your other discussion about “calling an activity through javascript” is a useful way to get clipboard data from javascript too.  Just call a small activity to pick up the data whenever you need it.  /Eric

December 8, 2015 - 10:44am
Response to ericosman_GCS

Eric there I m stuck with how to return value from Activity to the calling javascript. Any idea of how to return values from activity to javascript?

December 8, 2015 - 11:09am
Response to RasaiyaNadar

Use a Show-Property method that returns either a property value or parameter to your session and that gets captured in the js variable "thisVar"

var oSafeUrl = new SafeURL("ActivityName");

var thisVar = pega.u.d.asyncRequest('GET',oSafeUrl);

To return the whole page, use Show-Page.

December 8, 2015 - 11:47am
Response to RasaiyaNadar

Look at how DynamicSelect returns the list of selected-items back to the browser.  It uses ajax.  I think you just need to use a Code-Pega-List and show-html.   /Eric

December 9, 2015 - 12:37am
Response to ericosman_GCS

Need to check syntax for ajax, I thought there would be in buit js api which does this

December 8, 2015 - 1:51pm

>>> Can we retrieve value from clipboard using JavaScript API ?

Although the answer is yes, a more within-guard-rails way to do it, which was alluded to before, would be:

1) Have a section on which you expose a property or list with appropriate Pega designer studio features.

2) Include a button or link on the section whose action list includes "refresh"

3) When the latest version of the clipboard property value is needed, the user clicks the button.


December 16, 2015 - 10:24am
Response to ericosman_GCS

To keep things simple , I thought there would be some api getvalue(Page.Property)