Question
Accenture
IN
Last activity: 16 Dec 2015 10:24 EST
Can we retrieve value from clipboard using JavaScript API?
Can we retrieve value from clipboard using JavaScript API ?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
GovCIO
US
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
1)
<script>
var testvar = "<%= tools.findPage("OperatorID").getProperty(".pyUserIdentifier").getStringValue(); %>";
alert("Operator ID:"+testvar);
</script>
2)
<script for="window" event="onload">
var testvar = "<pega:reference name="OperatorID.pyUserIdentifier"/>";
</script>
-
Aravind_CG C
Accenture
IN
Will try and share the results âº
-
BITTA NAVEEN KUMAR
Accenture
IN
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
else
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.
JPMC
IN
Hi,
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.
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?
Capgemini
IN
https://community.pega.com/sites/default/files/help_v719/javadocs/index.html?index-all.html
would be a good place to start.
Pegasystems
US
Hi,
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
Accenture
IN
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?
Capgemini
IN
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.
Pegasystems
US
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
Updated: 9 Dec 2015 0:40 EST
Accenture
IN
Need to check syntax for ajax, I thought there would be in buit js api which does this
Pegasystems
US
>>> 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.
/Eric
Accenture
IN
To keep things simple , I thought there would be some api getvalue(Page.Property)