Question
TCS
IN
Last activity: 20 Dec 2016 23:47 EST
Trying to refer to a clipboard property in a js , but not working
I am trying to refer to a clipboard property in a js file like below -
function launchSDP()
{
var e1 = tools.findPage("Clipboardpage").getProperty("propertyname").toString();
if(e1=="error" )
{ pega.u.d.reloadsection("current");
}
else
{ launch a harness;
}
}
[ what am trying to do is - if var e1 ="error" then reload the section, otherwise launch a harness ]
The error lies with the first step for loading the var e1 . Maybe am doing this in incorrect way. Can anyone tell me what would be a correct way?
***Updated by moderator: Lochan to update Categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
TCS
IN
Hi Abdul,
Just an update - I got the the clipboard value by setting that value to a hidden text control in my section and included var a = $('.keyclipb div div span').text(); in the script.
The keyclipb is the read/write class that we give in the advanced presentation option of the control.
Thanks a lot for your inputs.
Pegasystems Inc.
IN
Use the following syntax. Basically you are trying to access data via java api. You need to use scriplet tags like below.
var e1 = '<%= tools.findPage("Clipboardpage").getString("propertyname") %>';
Let us know if this helps.
-
Hieu Chu Pham Xuan
TCS
IN
That works! Thanks for the suggestion.
TCS
IN
Hi Rawap,
var e1 = '<%= tools.findPage("Clipboardpage").getString("propertyname") %>'; is correct syntax-wise but the value of e1 is not seetting as expected.
Have set an alert now to see what value is e1 holding and found it as - <%=tools.findPage("pyPortal").getString("posterrorkey").getStringValue()%>
instead of value from clipboard.
Can you please help on this.
Pegasystems Inc.
IN
Syntax seems to be correct here now. Just a silly question, Did you write the code or copy/pasted from here.
Sometimes copy/pasting might result in different format and would not take it as correct syntax.
TCS
IN
Initially I had copy/pasted and modified the variables. Now I have writted the code and still it shows the same thing.
TCS
IN
Is there anything to be defined or any files to be included so that it understands '<%=tools.findPage("pyPortal").getString("posterrorkey")%>' is not a text?
TCS
IN
Hi Pankaj,
Any suggestions would be helpful. Thanks
Pegasystems Inc.
IN
Syntax wise everything seems to be fine. Where exactly are you placing this code. Scriplet code will work inside JSP. Please share where are you using this code.
TCS
IN
Am calling the script from a button action of onClick event.
There is a Run DataTransfrom to call the service page and in its response dt , the mentioned variable(pyPortal.posterrorkey) is being set. The next action is the Run Script.
The code -
function launchSDP()
{
var e1 ='<%=tools.findPage("pyPortal").getString("posterrorkey") %>';
alert(e1);
if(e1=="error")
{
pega.u.d.reloadSection(pega.u.d.getSectionByName("DisplayConfirmationMsg","",""));
alert("reload");
}
else
{
pega.desktop.showHarnessWrapper( "current","Data-Portal","PanelContentHarness","","","pyPortalHarness","Yes","","Yes","",":event","","","","","","false");
alert("launch");
}
}
The functionality of the code is to check the posterrorkey value and either launch a harness/refresh section .
Standard Chartered Bank
IN
Hi AparnaG8,
You were missing a dot(.) here var e1 ='<%=tools.findPage("pyPortal").getString(".posterrorkey") %>';
I have tried it practically and posted the solution, please try it, and let me know.
If still not getting, in pages and classes of the section specify the pyPortal and its class.
Attaching the screen shots of the HTML and JS code and the alert messages.
Hopes it helps
Thanks
Abdul Razi
TCS
IN
Hi Abdul,
Thanks for your response.
I had tried this earlier but found the same issue. Please find attached the screenshot of the alert(e1);
PS : This code is in TextFile with extension as .js
Standard Chartered Bank
IN
Can you please share a screen shot, how you are including the .js file and where you are inserting the scriplet to get the value from clipboard and how the function is being invoked.
TCS
IN
Hi Abdul ,
Please find attached the screenflow.
Standard Chartered Bank
IN
Hi Aparna,
We cannot include a scriplet or an expression tag directly in a .js file, it works for only .jsp file at JSP compiler does the remaining work.
Trying for the solution, will let you know once i found that.
Thanks
Abdul Razi
TCS
IN
It would be really helpful if you can find something on this.
Standard Chartered Bank
IN
Hi,
If you can write an additional activity to call it from JS function using the javascript which returns the out param from the activity as your required property value and then check the condition and perform the action steps as required.
For your reference, I have attached the example.
Let me know if it helps.
Accepted Solution
TCS
IN
Hi Abdul,
Just an update - I got the the clipboard value by setting that value to a hidden text control in my section and included var a = $('.keyclipb div div span').text(); in the script.
The keyclipb is the read/write class that we give in the advanced presentation option of the control.
Thanks a lot for your inputs.
Inovar
SA
Hi Aparna,
Thanks for the reply.